I'm trying to write a regex to parse a (seemingly very simple) piece of text like this.
some stuff
First name: John
Last name: Smith
more stuff
I want to capture the first and last name, so I tried a regex like this:
(?<=First name:\s*)(?<FirstName>\w+)(?<=\s*Last name:\s*)(?<LastName>\w+)
This fails to find a match. Each part (first name and last name) works individually, but they don't work together. Also, the following works
(?<=John\s*Last name:\s*)(?<LastName>\w+)
but when I move "John" out of the non-matching group...
John(?<=\s*Last name:\s*)(?<LastName>\w+)
... it doesn't match!
What am I doing wrong here?