You're quite right about the use of ?. I forgot that it stands for {0,1}.
What would you say about /^[-+]?\d+\.?0*$/? No capturing or clustering parentheses necessary and it will accept an (optional) plus-sign as well.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: Re^3: positive integer identification (regular expression question)
by CountZero
in thread positive integer identification (regular expression question)
by noggon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |