[H-GEN] REGEX pattern required
Russell Stuart
russell-humbug at stuart.id.au
Wed Dec 8 01:14:58 EST 2004
On Wed, 2004-12-08 at 15:40, Gary Curtis wrote:
> This would not be a problem so long as the digits are always
> in [say] the third element AND elements one and two, together,
> represent the section of the string to the left of the digits.
I have not tested any of this, and from experience
any non-trivial regex has bugs. Its sort of a
corollary to "every non-trivial program has bugs".
That said a preg_match() should give you:
Input $match[0] $match[1] $match[2] $match[3]
-------------- --------- --------- --------- ---------
"12" "1" "" "12" ""
"12aaa" "12aaa" "" "12" "aaa"
"aaa12" "aaa12" "aaa" "12" ""
"1aaa12" "1aaa12" "1aaa" "12" ""
"1aaa12xx" "1aaa12xx" "1aaa" "12" "xx"
More information about the General
mailing list