Reputation: 35
I want to match any string that doesn't contain "S", if it contains it should be excluded.
Sample:
Sally Desk
Camp Silly
Not Bad
Expected Result:
Desk
Camp
Not
Bad
Upvotes: 1
Views: 3280
Reputation: 67968
I want to match any string that doesn't contain "S"
You can simply use (?!\S*S)\b\S+\b
.This uses lookahead
to check if string
doesnt contain S
See demo.
https://regex101.com/r/uF4oY4/1
Upvotes: 2