Reputation: 185
I'm trying to look at job descriptions that mention veterans but only when it's not in the equal opportunity employer disclaimer.
Say you were given the following text:
A) We love veterans!
B) We are an equal opportunity employer and value diversity at our company. We do not discriminate on the basis of race, religion, color, national origin, gender, sexual orientation, age, marital status, veteran status, or disability status.
C) We love veterans! We are an equal opportunity employer and value diversity at our company. We do not discriminate on the basis of race, religion, color, national origin, gender, sexual orientation, age, marital status, veteran status, or disability status.
I would like to match A but not B, but also match with C since it is mentioned before and after equal, but I only really care if it matches before or not.
This is what I've tried: veteran*.+(?=\s+equal)
Upvotes: 0
Views: 56
Reputation: 425033
Use a look ahead on a dot, and anchor the match from start:
^(?i)((?!\bequal\b).)*veteran
Word boundaries added to equal
so it still allows equalize
etc.
(?i)
turns case insensitivity on.
Upvotes: 1