in reply to Re: Need a Regular Expression that tests for words in different order and captures the values found.
in thread Need a Regular Expression that tests for words in different order and captures the values found.
It doesn't fail if one or more names are missing...
But isn't this a bug rather than a feature? Is there any point to matching on a string that contains none of the target substrings (and then interpolates a bunch of undefined values)?
Also, as pointed out by other respondents, (?=.*fred (\w+)) will match 'alfred the great' (capturing 'the') in addition to 'fred flintstone'.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Need a Regular Expression that tests for words in different order and captures the values found.
by furry_marmot (Pilgrim) on Jan 15, 2010 at 17:57 UTC | |
by AnomalousMonk (Archbishop) on Jan 15, 2010 at 20:11 UTC | |
by furry_marmot (Pilgrim) on Jan 15, 2010 at 20:47 UTC |