Reputation: 21
Out of the line Your name is: "Foo Bar"
I want to select Foo Bar
in regex only.
I have tried non-capturing groups without success : (?:^Your name is: ").*(?:")$
"(.*?)"
Works but I don't want the double quotes to be selected
Upvotes: 0
Views: 60
Reputation: 163207
As you tagged pcre, you don't have to use a lookbehind assertion but you can match the text and then use \K
to forget what is matched so far.
^Your name is: "\K.+(?="$)
See a regex demo.
Or without lookarounds at all and a capture group:
^Your name is: "(.+)"$
See another regex demo.
Upvotes: 2