I want to create a regular expression such that it can accept following values:-
100, 100.00, (100),(100.00),$100, $100.00, $(100), $(100.00)
and I am succeed in building the following regular expression:-
/^(\$?(?=\d*(\.\d{1,3})?$))|^(\$?\((?=\d*(\.\d{1,3})?\)$))/
but above regex fails if the value is just $
I want if the value is just $ then it should give not accept it..
But at the same time it should accept blank value also..
Please help me.
Thanks in advance
It seems that your integer part is never optional, so you should make sure the regex makes it mandatory (right now, even the empty string would pass your regex):
\d+means “one or more digits”.