Reputation: 507
I've been trying to figure this one out at regex101, but no luck yet. I want to match the second 's' in system for instance, but not if the s is at the start of the word. so I want to match the "s" in mos, or answer, but I dont want to match the s in space.
This is what I have tried so far:
s*(?<!\W)
with couple variations, but no luck yet.
Upvotes: 0
Views: 29
Reputation: 402483
A negative lookbehind is the way to go. I think you need this:
(?<!\b)s
Details
(?<!...)
- negative lookbehind\b
- word boundarys
- the letter s
to be matched (will not be matched if there is a word boundary before)Upvotes: 2