Regular Expression not start with two 'WW' or 'MM'

Viewed 43

1). modification require below expression

^.{0,100}$ this expression not begin with 'WW' or'MM' and not add spacial characters

other condition is

2). how can i add ^.{0,100}$ this condition in below expression

(?:WW[A-Za-z0-9]{10}|MM\d{8})$
1 Answers

For the first pattern, use a negative lookahead

^(?!WW|MM)[A-Za-z0-9]{0,100}$

For the second pattern, fill the rest for either part with any char until 100

^(?:WW[A-Za-z0-9]{10}.{88}|MM\d{8}.{90})$
Related