[H-GEN] REGEX pattern required
Russell Stuart
russell-humbug at stuart.id.au
Tue Dec 7 22:58:01 EST 2004
On Wed, 2004-12-08 at 13:42, Byron Ellacott wrote:
> The three groups are (.*?), ([0-9]+) and ([^0-9]*). The first matches
> as few characters as necessary to pad the expression out -- the ?
> modifier makes the * modifier non-greedy. The second matches one or
> more digits. The third expression requires that everything after the
> digit sequence be non-digits, that is, the digit sequence must match the
> right-most digit sequence.
>
> If you're using a different regex engine, you will need this adjusted to
> suit.
And just to refine it a bit further, the regex above will sort
of work with PHP's preg_match(), where "sort of" means the array
returned will have 4 elements - not the three Gary asked for.
But its probably close enough - just ignore the first element.
Gary's question originally asked for a regex to feed to
preg_split(). There is no regex you can pass to preg_split()
that returns what Gary wanted.
More information about the General
mailing list