Search code examples
regexwindowsnotepad

Regex: Match the word between tags


I have this almost 5000 html files with this meta tag, but with different content:

<meta name="Abstract" content="I must &#226;follow the path."/>

I want to match only the &#226;, from this particular tag. I made a regex, but doesn't work:

(?s)<meta name="Abstract" content=(&#226;)(.*\"/>)

Basically, &#226; means â in ANSI characters. I made a mistake and I got this into this meta tag. So, I need to replace all &#226; with simple a, but only in this particular meta tab, not in whole files.


Solution

  • For Notepad++:

    Find:

    (<meta name="Abstract" content=".*)&#226;(.*"\/>)
    

    Replace:

    \1a\2
    

    \1 and \2 refer to the capture groups. For more information, check this question.