I am trying to define the regular expression required for my ASP.NET validator to run properly. Currently with the expression below I am able to properly validate the following sample string in firefox but not in IE
12{2}12{0-9}1{12,13}
using
(({\d+\})*|(\d)*|({(\d+,)+\d+\})*|({(\d+)\-(\d+)\})*)+
After doing some research it seems that this is due to the lookahead bug but since I am fairly new to using regex I do not understand how I can modify it properly to work around the bug?
Please feed me with higher knowledge!!
EDIT:
The expression must match these three optional individual component that can be in the string in any order. I tried to come up with an expression describing each individual component and then merging them into a single expression.
{n} regex {\d+\} to match sample {423} optional digits
{n,n,n} regex {(\d+,)+\d+\} to match sample set of digit {24,25,26}
{n-n} regex {(\d+)\-(\d+)\} to match sample range of {0-9}
individual digits (\d) to match sample 232
EDIT 2:
In the end I will be using this expression and a special thanks to woohoo
((\d*\#*\**)*\{((\d*\#*\**)+|(\d*\#*\**)+\-(\d*\#*\**)+|((\d*\#*\**)+\,)+(\d*\#*\**)+)\}(\d*\#*\**)*)+
the expression supports digits # and * at every position.
I’m afraid the regular expression you posted above has some errors, and it looks too complicated for what you try to achieve. I would do it this way:
eventually you can add the + sign to match one or more of these,
or, if you want to match a specific number of those, use {m,n} quantitative expression:
In this case I made it to match exactly 3 pieces.