I have tried Regex accept numeric only. First character can't be 0 and What is the regex for "Any positive integer, excluding 0" however that didn't work as per my requirements.
I want exact 6 digit numeric number but shouldn't start with 0
I've tried
^[1-9][0-9]{6}*$
^([^0][0-9]){6}$
...
Need fine tuning.
The problem with
^[1-9][0-9]{6}*$is it is an invalid regex because of{6}*and^([^0][0-9]){6}$is that it is allowing any character that is not0followed by six digits.Use
Explanation:
^: Starts with anchor[1-9]: Matches exactly one digit from 1 to 9[0-9]{5}: Matches exactly five digits in the inclusive range0-9$: Ends with anchorRegex101 Playground
HTML5 Demo: