[Solved] Search for a url in a string and remove enclosing tag

[ad_1]

The correct answer is use the HTML Agility Pack and parse the html properly

However, in regards to you comment

I have 13000 sharepoint sites and for each site I have to parse the
master page and remove the above specific script tag

You can use something nasty like this i guess :/

Regex.Replace(yourPage, @"<script src=""https://cdn.getsmartcontent.com/.+?\/script>", String.Empty);

You could use the multiline option i guess, but this is still a bad idea

Note/Disclaimer/Warning : See bold comment

5

[ad_2]

solved Search for a url in a string and remove enclosing tag