basickarl
basickarl

Reputation: 40561

Regex, match any character after match

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.

enter image description here

Upvotes: 0

Views: 205

Answers (1)

Tomalak
Tomalak

Reputation: 338376

You want a look-ahead check:

(?=.*:third:).*

https://regex101.com/r/48Adar/1

Upvotes: 1

Related Questions