What you'll need to do is use multiple regexes, or multiple captures within your regex:o followed by n followed by e, followed by any character (including a newline -- /s switch) repeated zero or more times (but as few as possible) followed by e followed by e and saved in $1.
It's closer to what you want, though it uses $1 and $2. japhy is right -- your question is a little vague.m/(one).*?(\s\w+ee)\b/s; That is, match: o followed by n followed by e (captured in $1) any character (including newline -- /s switch) repeated zero or more times (as few as possible while still allowing a match) followed by a whitespace character (\s) followed by a word character (alphanumeric) repeated at least one time followed by e followed by e (captured in $2) followed by a word boundary
In reply to Re: minimal greed
by chromatic
in thread minimal greed
by gregor-e
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |