Regular Expressions 101

Community Patterns

NATO Stock Number (with or without NSC)

0

Regular Expression
PCRE (PHP <7.3)

/
^ *(\d{4}-?)?\d{2}-?\d{3}-?\d{4} *$
/

Description

RegEx to validate a NATO Stock Number with or without the NATO Stock Code and with or without dashes

Submitted by Matthew Perryman - 8 years ago