[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Regular expression

I'm looking for the regular expression for the following:

- First char = 1...9
- 2nd to 10th char = numeric 0...9
- no spaces, points, signs

Example:

1000000009
456
709060
0
go4java
Asked:
go4java
  • 3
  • 2
1 Solution
 
ozoCommented:
/^[1-9]\d{1,9}$/
0
 
go4javaAuthor Commented:
That was valid???? 010
0
 
ozoCommented:
No,
"010" =~  /^[1-9]\d{1,9}$/
is false (not First char = 1...9)
0
 
ozoCommented:
Was that not what you wanted?
0
 
go4javaAuthor Commented:
yes, thank you. I got the right direction...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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