N is a positive integer with a negative sign matches

var reg = / ^ -? [1-9] {1} \ d * $ / ig;

 

Match: 123 -123

Can not match: 0123, -0123

 

Code or your own good ~

 

Guess you like

Origin www.cnblogs.com/abrahamlee/p/11122160.html