Reputation: 1078
I need a regex pattern to find a number like: 1234567-4
Thanks in advance!
Upvotes: 0
Views: 40
Reputation: 2686
If the first digit can not be 0
[1-9]\d{6}-\d+
if the first digit can be 0
\d{7}-\d+
Upvotes: 2
Reputation: 72885
Depending on the language you're using, this ought to do it:
^\d{7}-\d+$
Example and explanation: http://regex101.com/r/jM0bN5/1
Upvotes: 1