centricC
asked on
Regex
Can someone help me write a regex for the following number range?
5250-5429
Thanks.
5250-5429
Thanks.
5(2[5-9]\d|3\d\d|4[0-2]9)
Try:
(?:52[5-9]\d|53\d{2}|54[01 2]\d)
(?:52[5-9]\d|53\d{2}|54[01
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Correction to mine:
5(2[5-9]\d|3\d\d|4[0-2]\d)
Actually ozo's pattern is even better... I'd just go with that :-)
5(2[5-9]\d|3\d\d|4[0-2]\d)
Actually ozo's pattern is even better... I'd just go with that :-)
Yeah, except he may not be searching just the number; he may be searching a string for these numbers...if that's the case, try this:
(?<!\d)5(2[5-9]|3\d|4[0-2] )\d(?!\d)
(?<!\d)5(2[5-9]|3\d|4[0-2]