Regex pattern can't figure out

This will work

^\d{4}-\d{3,4}-[23]$

Regex Demo

Regex Breakdown

^ #Start of string
 \d{4} #Match 4 digits
  - #Match - literally
  \d{3,4} #Match 3 or 4 digits
  - #Match - literally
  [23] #Match 2 or 3
$ #End of string

Browse More Popular Posts

Leave a Comment