Search code examples
regexvb.netstringtagsquotes

How to Find Quotes within a Tag?


I have a string like this:

This <span class="highlight">is</span> a very "nice" day!

What should my RegEx-pattern in VB look like, to find the quotes within the tag? I want to replace it with something...

This <span class=^highlight^>is</span> a very "nice" day!

Something like <(")[^>]+> doesn't work :(

Thanks


Solution

  • It depends on your regex flavor, but this works for most of them:

    "(?=[^<]*>)
    

    EDIT: For anyone curious how this works. This translates into English as "Find a quote that is followed by a > before the next <".