Search code examples
regexreplacehtml-content-extraction

Regular Expression change text between tags


I have some code in the following layout,i m using textcrawler to do a find and replace

<a>
Name=LineA
epsium
ask
answer
line=10
color=red
</a>

<a>
Name=LineB
Color=Blue
</a>

...

Now the question is what regular expression i need to use so as to remove the second block of code between <a> and </a>


Solution

  • <a>(\s*?Name\=LineB[\S\s]*?)</a>
    

    It captures all text between and including the <a></a> tags that starts with the text Name=LineB.