regex for whatever is between quotes?

  • Thread starter Thread starter Ellery Familia
  • Start date Start date
E

Ellery Familia

which regular expression will return whatever is between a pair of single
quotes or double quotes?

this is a 'sample sentense' to be used as the target string.
 
(['"])([^'"]*)\1

Use + instead of * if you don't want to return empty strings, escape the
quotes according to the language you use and don't forget that the first
match will be the quote, the text inside is a second matched expression.

Jerry
 
Back
Top