Regex regular expression minimum character amount


Regex regular expression minimum character amount



I have the following regular expression:


^[8][0][1-3][0-9][0-9][0-9]



How would I make it so that I have this expression but also so that the minimum amount of characters is 6.



Thanks





Your pattern already matches 6 numbers. What is your question?
– Tim Biegeleisen
Jun 29 at 9:47





It exactly does what you ask for. It matches 6 digits at the start of the string.
– Wiktor Stribiżew
Jun 29 at 9:47




1 Answer
1



Your pattern already matches what you asked for. If you want to simplify it you can write it as:


^80[1-3][0-9]{3}



And if you want at least 6 characters but remaining being only 0-9 digits, then:


^80[1-3][0-9]{3,}$






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Export result set on Dbeaver to CSV

Opening a url is failing in Swift