Home All Groups Group Topic Archive Search About
Author
9 Jun 2005 5:21 PM
Marianne
I have a fairly simple pattern but am stuck on the very end.  Simply, it
needs to match any character grouping that is separated by more than a
single space:

This is one group      and this is another group    and this is a third
group

My regex is:
..+?(?:\s{2,})

The only problem is that the last group isn't captured since it ends with a
line terminator and not 2 or more spaces.  So the question is how do I
account for this as well?  Thanks.

Marianne

Author
10 Jun 2005 4:49 PM
Luc E. Mistiaen
You might try to end with (\s{2,}|$)

/LM

Show quoteHide quote
"Marianne" <Marianne@nospam.nospam> wrote in message
news:u%236QGfRbFHA.3120@TK2MSFTNGP12.phx.gbl...
>I have a fairly simple pattern but am stuck on the very end.  Simply, it
>needs to match any character grouping that is separated by more than a
>single space:
>
> This is one group      and this is another group    and this is a third
> group
>
> My regex is:
> .+?(?:\s{2,})
>
> The only problem is that the last group isn't captured since it ends with
> a line terminator and not 2 or more spaces.  So the question is how do I
> account for this as well?  Thanks.
>
> Marianne
>

Bookmark and Share

Post Thread options