i'm trying put regex pattern matches string contain word "front" , not contain word "square". have can accomplish individually, having trouble putting them together.
front=yes
^((?=front).)*$
square=no
^((?!square).)*$
however, how combine these single regex expression?
you can use single negative lookahead this:
/^(?!.*square).*front/
(?!.*square)
negative lookahead assert failure ifsquare
present anywhere in input^.*front
matchfront
anywhere in input
Comments
Post a Comment