07-29-2015, 10:52 AM
This regex has many flaws.
for eg: 1900 is not getting matched which is withing the range.
these types of conditions are best if handled in code than by regex.
Anyways...the regex for this specific condition is as below:
for eg: 1900 is not getting matched which is withing the range.
these types of conditions are best if handled in code than by regex.
Anyways...the regex for this specific condition is as below:
Code:
(?(^128[7-9]{1}$)(128[7-9])
|(?(^12[8-9]\d$)(12[8-9]\d)
|(?(^1[2-9]\d{2}$)(1[2-9]\d{2})
|(?(^[2-8]\d{3}$)([2-9]\d{3})
|(?(^983[0-4]$)(983[0-4])
|(?(^98[0-3]\d$)(98[0-3]\d)
|(?(^9[0-8]\d{2}$)(9[0-8]\d{2})
)
)
)
)
)
)
)