RegEx In Header

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



RegEx In Header



i've a problem with a website.
I cannot modify the html but i can, with regex, make some change to the code.



The CMS take the first line of text and place it automatically in the header of the page in the meta description.



If in the first part of the text there are some link the CMS don't clean the html and place the link in the header breaking the page.



I was working on a regex to intercept the code and remove it.



The example of the code is:


<meta name="description" content="sometext<a href="">anchor text</a> and <a href="https://www.url.com/path1/path2">anchor</a>? a lot of text" />



The links in the text could be 1, 2, 3 or more.



At the moment i've create the:


(?:(<meta name="description" content="|<meta property="og:description" content="|<meta name="twitter:description" content="))(((?:[^<]|[^/>]*)(<(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^s>]*)*>)))



but i miss somethink.



Can someone help?



Thank you









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard