regex - Match any number (or negitive number) except '-0' -
i have followin regex match number between 1 , 4 didgets in length, -
character if desired.
^[-]?\d{1,4}$
however, i'd exclude list of possible matches -0
. i've tried following, seems break everything.
^[-]?(?!-0)\d{1,4}$
how can achieve goal?
just put excluding group before :
^(?!-0)-?\d{1,4}$
note don't have put minus sign between brackets.
Comments
Post a Comment