in reply to Re: combined into a single regex
in thread combined into a single regex
I think, this would be equivalent:
/^-?(\d*)\.?(\d*)$/
OTOH: I wouldn't consider "-." a legal number.
So maybe this is better?
/^-?((\d+\.\d*)|(\.?\d+))$/
This wouldn't capture like yours does, but the captured parts aren't used. So you might want to consider using (?:...)...
|
|---|