Reputation: 40561
I'm trying to match the entire string when I have identified the middle part.
I have the string:
first:second:third:forth:fifth
I wish to match it when I write for example: :third:
I do not wish to match it when I write for example :sixth:
I've figured out the first half, been looking around for the regex to extend to include any character after the match.
Upvotes: 0
Views: 205
Reputation: 338376
You want a look-ahead check:
(?=.*:third:).*
https://regex101.com/r/48Adar/1
Upvotes: 1