Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

Regular Expression - numeric only (Either a zero or 10 digit number)

Hello Experts,

I need a regular expression that will force the user to enter ether:

1) a zero
2) a ten digit number

So this needs to be numeric only, no spaces, dashes, ect.

Thanks!
Moe
0
mauricerichard
Asked:
mauricerichard
  • 2
1 Solution
 
farzanjCommented:
^0|\d{10}$
0
 
mauricerichardAuthor Commented:
Perfect, thank you for the solution!!
0
 
farzanjCommented:
Glad to help :)
0
 
ozoCommented:
I think you meant
^(0|\d{10})$

otherwise $ would not be required after 0 and ^ would not be required before \d{10}
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now