user3750290 user3750290 - 1 year ago 81
Javascript Question

Regular Expression search to search exact match

I am very much new to regex.

I have a scenario where I need to check the textbox value to the below format:

Format: AZnnnnnnn-nnn

The value has to start with "AZ" followed by 7 numerics and -(hiphen) and followed by 3 numerics

Can someone help on this

Answer Source

You can use this regex:


^       -> start of string
AZ      -> AZ
\d      -> digit
{7}     -> exactly 7
-       -> hyphen
{3}     -> exactly 3
$       -> end of string
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download