| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
Hello,
I've a little problem:
A RegEx should match, when 2 words are found in one text-line in
random order.
For a simplified example, it should return true, wenn the line
contains "color" and one of the words "blue" and "red":
"bluecolor", "blue-color" or "red color", "color red"...
.(?=(blue|red))(?=color)
Amongst others I tried to solve this with look-around-assertions but
without success. (It's irrelevant whether the RegEx matches, when one
of the words is in the very beginning or the end of the line. They
only occur in the middle. There's no need to catch substrings.)
In this way it should work, but the I hope, that it can be simplified,
because in reality there are more and longer words.
.*((blue|red).*color)|(color.*(blue|red))
Does anybody have an idea?
-davidoff12001