This is what i've been using
\$?[0-9]+\.*[0-9]*
But when i was doing some testing i noticed that things like
$$$34.00
would return as a match (but matcher.group()
) just returns the matched substring. I don't want it to even pass the regular expression if the user enters more than one dollar sign so i tried this:
\${1}[0-9]+\.*[0-9]*
but this seems to behave the same as the regular expression i first typed. Right now i'm testing this in java but, i plan to use it in c++ using the Boost libraries. But Please don't give me that solution here because i'm trying to learn without someone giving me the answer.
But i do need help making it so the user can only enter one dollar sign (which is what i thought \${1}
would do)