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 ifsquarepresent anywhere in input^.*frontmatchfrontanywhere in input
Comments
Post a Comment