my @words = split /\s+$WANT\s+/, $text;
Now, you have the text on either side of "blue". Use my @other_words = split ' ', $foo; to get at the other words.
A regex is overkill and very unmaintainable. Keep it simple!
In reply to Re: regexp matching around a word
by dragonchild
in thread regexp matching around a word
by kidd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |