Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
^[0-9][0-9]{0,6}$
/

Description

var pattern='/^[0-9][0-9]{0,6}$/'; /* int match 9 digit / /********************************************* *

  • ^ starting point
  • 1st [0-9] number should be start between 0 to 9
  • 2nd [0-9] number should be end between 0 to 9
  • 3nd {0-6} number length should be exact 6 digit
  • $ its show the end of string or data

************************************************/

Submitted by sudhir k gupta - 10 years ago