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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top