Page 1 of 1

Error when Regexp tried to run

Posted: Tue Sep 19, 2006 3:49 pm
by hydroxide
Why does this

Code: Select all

$date_range = "9/15/06-9/19/06";

$match_exp = "/(?<Month>\d{1,2})\/(?<Day>\d{1,2})\/(?<Year>(?:\d{4}|\d{2}))(?x)/";

preg_match_all($match_exp, $date_range, $dates_match);
Give me this error? (line 68 being the preg_match_all line)

Code: Select all

Warning: Compilation failed: unrecognized character after (?< at offset 3 in myscript.php on line 68
My regexp checks out with a testing program I'm using...

Any help would be appreciated.

EDIT:This doesn't work either.

Code: Select all

$match_exp = "(?<Month>\d{1,2})/(?<Day>\d{1,2})/(?<Year>(?:\d{4}|\d{2}))(?x)"
it says

Code: Select all

Warning: Unknown modifier '/' in myscript.php on line 68

Posted: Tue Sep 19, 2006 3:58 pm
by feyd
"(?<" is a lookbehind trigger.