I want to write a regular expression for a mobile number
9042248903
I tried using the below expression
^\d+([\.\,][0]{2})?$
^[0-9]+$
Those specifications can be met with
^[0-9]{10,15}$
The start and end markers ^$
ensure there's nothing on either side.
[0-9]
gives you a digit.
{10,15}
meannse ten to fifteen occurrences of that digit speciffication.
这也可以!
/^\d{10,15}$/
try this
"[1-9][0-9]{9,14}"
if(!teststring.matches("[1-9][0-9]{9,14}")) {
// blah! blah! blah!
}
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.