S
shifty
Hi,
I'm trying to hack my way through a regex for a chunk of code I'm going
to use. I've been using a Regex Coach to run through this and I think
I have correct syntax.
I am trying to find any one of several 'hacked' variants of the word
"microsoft" (ex: m1cr0s0ft, miçr0§0ft, etc.), but NOT match on the
actual word "microsoft". I need the regex to be case sensitive.
This is my regex - it seems to work, but I don't know if the syntax is
honestly correct and I don't want it to break later:
(?i).*\b(?
?!microsoft)m+[i1l\\\|!¡îíìï]+[Cç]+r+[o0öøõôóòð]+[s§]+[o0öøõôóòð]+f+[t\+]+)\b.*
This expression will:
Be case insensitive
Have a word boundary to limit only finding the word I'm looking for
Allow anything to preceed this word's boundaries
Match on several variants of 'microsoft' as long as negative lookahead
doesn't find the proper spelling
Will not capture the match if one is found
Is this correct? Any help is appreciated. I'm going to need to knock
out several of these things.
I'm just starting with regex, and I'm totally in love - but it's really
easy to be inefficient and it's also easy really, really easy to miss
"false positives" caused by overlooking an aspect of your expression.
Reminds me of 'chess vs. chemistry' or something.
I'm trying to hack my way through a regex for a chunk of code I'm going
to use. I've been using a Regex Coach to run through this and I think
I have correct syntax.
I am trying to find any one of several 'hacked' variants of the word
"microsoft" (ex: m1cr0s0ft, miçr0§0ft, etc.), but NOT match on the
actual word "microsoft". I need the regex to be case sensitive.
This is my regex - it seems to work, but I don't know if the syntax is
honestly correct and I don't want it to break later:
(?i).*\b(?
This expression will:
Be case insensitive
Have a word boundary to limit only finding the word I'm looking for
Allow anything to preceed this word's boundaries
Match on several variants of 'microsoft' as long as negative lookahead
doesn't find the proper spelling
Will not capture the match if one is found
Is this correct? Any help is appreciated. I'm going to need to knock
out several of these things.
I'm just starting with regex, and I'm totally in love - but it's really
easy to be inefficient and it's also easy really, really easy to miss
"false positives" caused by overlooking an aspect of your expression.
Reminds me of 'chess vs. chemistry' or something.