I have a regular expression string (see below). What I would like is for it to select all the appropriate patterns but not include patterns starting with MZ
PATTERN – ^[A-Z]{2}\d{7}[A-Z]?[A-Z]?$
I have read some posts regarding look ahead assertions but I’m affraid they are too complicated for me to understand.
Can anyone help?
Go with pattern
where
(?!...)is a negative lookahead, which makes sure thatMZis not at the beginning of the string.