locked
What is the regular expression for this input? RRS feed

  • Question

  • User1158330421 posted

    The regular expression takes this input:

    "SJDC-12345678912345678"

    Basically, it's 4 characters followed by "-" and then 16 numbers 

    Monday, July 2, 2018 1:14 PM

All replies

  • User475983607 posted

    The sample does not match the requirement.

    This

    ^[A-Z]{4}-[1-9]{16}$

    matches 

    SJDC-1234567891234567

    https://regex101.com/

    Monday, July 2, 2018 1:25 PM
  • User-1171043462 posted

    Try this

    ^[A-Z]{4}-[\d]{16}$

    Monday, July 2, 2018 1:42 PM