First rounder 'John Smith' had a good game.

Second rounder 'Jim O'Rielly' is on fire!

What I ultimately want is to get both names between quotes John Smith and Jim O'Rielly, however the tricky part is the names that include apostrophe like the second.

I initially was using '/\'([^\']*)\'/' to get the text inside the quotes, but doesn't work for the second case - this would only return Jim O.

I then thought to use .+?(?=had) in order to get everything up to the word had, but it needs to be either had or is, and I don't want the words First rounder, etc.

I need to essentially combine these, so I can get only the text inside the quotes, but UP UNTIL either word had or is, and I just want the text without quotes.


  • You can alternate between matching non-'s, and matching 's which have word characters on either side. This way 's in the middle of a word will be matched, but 's at either end of a word won't.