Any regexp expert here?

Hi,

I’d like to find some text within a large block of text with two key words.
So, let the large block of text be var = LongText,
keyWord 1 be word1
keyWord 2 be mystuff-id

And these two key words are fairly close to each other and there would be multiple instances of both key words in the large block of text.

What regular expression can help us to find them?

Thanks.

Something like this? Replace “word1” and “word2” with your “keywords”:

<cfscript>		
	regex  = "word1(.*?)word2";

	string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, word1 quis nostrud exercitation ullamco laboris nisi ut aliquip word2 ex ea commodo consequat. Duis aute irure dolor in word1 reprehenderit in voluptate word2 velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

	result = reFind(regex, string, 0, true);

	dump(result);
</cfscript>

Sounds good, I’ll try it, thanks.