Regular Expressions 101

Community Patterns

Match any number greater than 14 using regexp

0

Regular Expression
ECMAScript (JavaScript)

/
^0*(?:[1-9][0-9]{2,}|[2-9][0-9]|1[5-9])$
/
mg

Description

Any number greater than 14 means:

  • Any number with 3 or more digits with possible leading 0's
  • Any number with 2 digits where the first digit in in the character class [2-9]
  • Any number with 2 digits where the first digit is 1 and the second digit in in the character class [5-9]

Inspired by: https://stackoverflow.com/questions/52700629/to-match-any-number-greater-than-15-using-regexp

Submitted by anonymous - 2 years ago