Help with Regular Expression
Posted on 2007-08-01
I need help real quick with a regular expression i'm trying to get to work correctly.
The combination that I need to pick up would look like this in the text (replaced some of the numbers/text to make it generic): "WATERMELON some text here some text here 27 some text here MATCH TEXT HERE 250". From that section I would want to pull out "WATERMELON MATCH TEXT HERE 250" or even better, "WATERMELON 250" if that is possible.
I've tried some various ideas such as [WATERMELON]\s*.*[MATCH]\s*[TEXT]\s*[HERE]\s*\d* but that doesn't match up at all. I'm not sure how to search for whole words without doing something generic like "\w*" to represent the word.
Any help would be greatly appreciated!