Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Regex to match strings between quotes

I try to create a regular expression to match strings between quotes but it seem’s not working.

My RegExp:

\[shortanalytics\snumber=[0-9]+\stoptext="[A-Za-z]+"\sbottomtext="[A-Za-z]+"\sicon=[A-Za-z]+\]

Text to match:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

[shortanalytics number=60 toptext="super test" bottomtext="test 2" icon=add]

>Solution :

You can try using the following one:

"([^"]+)"

Explanation:

  • ": quote
  • ([^"]+): any character other than quote
  • ": quote

This will match any string between paired quotes, regardless of the content of the string between quotes.

In order to get your content, reference the first group of each match.

Try it here.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading