Reputation: 25
I'm looking for a way to extract names from the text below, i.e., any string occurrences that appear between "applicant(s).: " and the following ",Please". Is this possible?
Please enter the name of your school.: Test Primary School,Please enter the name(s) of your applicant(s).: Sandra McTest,Please enter the name of your school.: Test Primary School,Please enter the name(s) of your applicant(s).: Grace Test, Brad Test, Lovelace Test,Please enter the name of your school.: Test Primary School,
I'd really appreciate some help as I'm just getting started with regex. Thanks heaps in advance.
Upvotes: 1
Views: 46
Reputation: 2363
You can do it using look-arounds
/(?<=applicant\(s\)\.:).*?(?=Please|$)/gm
It captures everyting between applicant(s).:
string and Please
string or end of line
.
Upvotes: 1