简体   繁体   中英

Javascript regex to match empty strings, non-digit characters or numbers with more than 1 digit?

I'm trying to match empty strings, non-digit characters or numbers with more than 1 digit.

Examples:

"", "a", "abc", "10"

I tried:

/^([^1-9]*)|(\d{2,})$/

but it doesn't work.

您可以使用以下正则表达式:

/^(\d{2,}|[^\d]+|)$/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM