Regex match, check number values are within a range
Posted: Tue Jan 13, 2009 8:13 am
Hi everyone
I've been slowly getting used to regular expressions over the past 6 months. It was always something I'd put off learning, and am now finding them very useful... thanks to Chris Corbyn's excellent tutorial on here.
I'm now stuck on a particular regex, I think it might be something advanced that I've not learnt yet.
Is there a way to get a particular group of numbers are within/outside of a numerical range?
So I have the following regex pattern:
And I want to check that the middle group of numbers is between 11 and 58
Is this possible within regular expressions?
As an alternative I can just split the string apart and test it in PHP.
Just wondered if there was a way to do this with regular expressions?
Cheers, B
I've been slowly getting used to regular expressions over the past 6 months. It was always something I'd put off learning, and am now finding them very useful... thanks to Chris Corbyn's excellent tutorial on here.
I'm now stuck on a particular regex, I think it might be something advanced that I've not learnt yet.
Is there a way to get a particular group of numbers are within/outside of a numerical range?
So I have the following regex pattern:
Code: Select all
preg_match_all('#[0-9]{2}[a-zA-Z]{3,8}[0-9]{2}&{7}[0-9]{2}#', $due_date, $matches);Is this possible within regular expressions?
As an alternative I can just split the string apart and test it in PHP.
Just wondered if there was a way to do this with regular expressions?
Cheers, B