Home:ALL Converter>JavaScript regex to validate complicated string

JavaScript regex to validate complicated string

Ask Time:2012-02-20T02:15:38         Author:Đinh Hồng Châu

Json Formatter

Could you please help me to provide a RegEx pattern to validate a string which satisfy:

  1. length from 4 to 10 (strictly)
  2. first 3 characters must be string (A-Z a-z)
  3. the remain characters must be number without 00 as prefix, I mean ABC15 is passed but ABC0015 is not.

This problem took me so much time and I have tried so many regex patterns, but I still have no solution for it. Thank you so much.

Author:Đinh Hồng Châu,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/9351790/javascript-regex-to-validate-complicated-string
Rob W :

Use this one:\n\n/^[a-z]{3}(?!00)\\d{1,7}$/i\n\n\nExplanation:\n\n/\n^ Start\n[a-z]{3} Three letters.\n(?!00) Must NOT be followed by two zeros.\n\\d{1,7} One to seven digits.\n$ End.\n/i ignore case flag.\n",
2012-02-19T18:19:45
yy