Hi,
l have a problem with regular expression.
I want to match a string and it have some rules, but I don't know how to express it through regular expression.
For example, I want to match "xbcd". (where x can be any character)
For exmaple ,"xbcd" matches "rbcd","obcd","pbcd" but not "abcd" , "wbcd" or "bcd".
Does anybody know how to express it?
Regular expression Problem
Re: Regular expression Problem
Hello, needle := "[rop]bcd" matches, eg, haystack := "rbcd" but not haystack := "abcd".
Cheers.
Cheers.
Re: Regular expression Problem
Hi j123258,
You will need to specify for this, as indicated by Helgef, a class of characters. See in particular the 'Classes of characters' part of the RegEx quick reference. Example with the 'NOT version' instead which can be I think - and depending on your goal and the nature of input - just as relevant:
Hope this helps.
You will need to specify for this, as indicated by Helgef, a class of characters. See in particular the 'Classes of characters' part of the RegEx quick reference. Example with the 'NOT version' instead which can be I think - and depending on your goal and the nature of input - just as relevant:
Code: Select all
for each, string in ["rbcd","obcd","pbcd","zbcd","abcd","wbcd", "bcd"]
{
RegExMatch(string, "[^awc]bcd", match)
MsgBox % match
}
Re: Regular expression Problem
Thank you for your answer,Helgef and A_AhkUser.
I just started learning RegEx, It is so interesting.
I just started learning RegEx, It is so interesting.