$test= eregi('April[12-20]2003',$date);
if $date is a date in this format: May 12 2003
how can I specify a range of dates like April [12-20] 2003 to match with it? I can't figure out how to get the spaces in, because right now its trying to match April122003 for example against the $date. I don't even know if i'm doing the range of numbers right.
Any assistance would be appreciated
Regular Expression, searching for a date
Moderator: General Moderators
- Templeton Peck
- Forum Commoner
- Posts: 45
- Joined: Sun May 11, 2003 7:51 pm
- Templeton Peck
- Forum Commoner
- Posts: 45
- Joined: Sun May 11, 2003 7:51 pm
- Templeton Peck
- Forum Commoner
- Posts: 45
- Joined: Sun May 11, 2003 7:51 pm
To be entirely accurate what i'm trying to do is match a date which is in a variable called $date and is in this format : March 12 2003 (no comma's or anything just spaces)
a bunch of dates are passed to $date from a file and I want to know how to search a range of dates to match those dates
like March[12-20] 2003 is a range I could search against the dates from file and get a match for the one example date I gave above.
eregi('April+[11-21]+2003','$date'; is what I have but it doesn't work with or without plus signs, so how can I search the range April[11-23]2003 against the $date variable and get a match if April 11 2003 was the date in the $date file
thanks
a bunch of dates are passed to $date from a file and I want to know how to search a range of dates to match those dates
like March[12-20] 2003 is a range I could search against the dates from file and get a match for the one example date I gave above.
eregi('April+[11-21]+2003','$date'; is what I have but it doesn't work with or without plus signs, so how can I search the range April[11-23]2003 against the $date variable and get a match if April 11 2003 was the date in the $date file
thanks
-
Tubbietoeter
- Forum Contributor
- Posts: 149
- Joined: Fri Mar 14, 2003 2:41 am
- Location: Germany
try ereg and test $reg if it is in the range yoou wnat.
see php.net for the function.
as far as i know you can't to this directly within the expression, as you can only determin the kind of values not the range in the regexp
also see:
http://www.phpbuilder.com/columns/dario19990616.php3
see php.net for the function.
as far as i know you can't to this directly within the expression, as you can only determin the kind of values not the range in the regexp
also see:
http://www.phpbuilder.com/columns/dario19990616.php3