I'm trying to match a word ("Junior Consultant") not followed by a specific string "(m/f)" and allow multiple words (up to 5 words) in between.
Should match: Junior Consultant in New York Junior Consultant Banking Junior Consultant w1 w2 w3 w4 w5 Junior Consultant w1 w2 w3 w4 w5 w6 (m/f)
Should NOT match: Junior Consultant in New York (m/f) Junior Consultant (m/f) Junior Consultant w1 w2 w3 w4 w5 (m/f)
This is what I got so far: Junior Consultant((?!\\s\\(m\\/f\\))(\\s\\w+)){0,5}
Almost there, but you have to match all zero to five words before the "(m/f)" part. Try this:
/Junior Consultant(?!(\s\w+){0,5}\s\(m\/f\))/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.