March 5th, 2012, 11:05 AM
Help with regular expression
i'm trying to build a regular expression that will look for a specific combination of strings but must not include a specific combination, and i'm having problems
what i need is to find all strings that:
1. contain the phrase "*contain*love*" (meaning, the sentence "contain love" is good, the sentence "contain big love" is good, the sentence "must contain great love" is good, the sentence "might contain very big love indeed" is good, etc.) - this part is easy and i don't have an issue with it.
2. DO NOT contain the exact combination "love child" (meaning, the sentence "might contain very big love sick child" is ok, but the sentence "might contain very big live child today" should not match - this is where i'm stumped
can anyone help ?
March 5th, 2012, 12:54 PM
("contain" as a word, then stuff, then "love" as a word)
For #2 do the same thing but check that the expression did not match. In regular expressions it's a lot easier to try to match something that exists than something that doesn't exist.
March 6th, 2012, 12:19 AM
Please don't cross-post.
I replied on the other thread this morning.