Dan
Dan

Reputation: 5986

Remove alt attributes from HTML

I have a huge HTML file which I'm trying to format to be able to import the content into a different application. The one thing that remains is that I need to remove all alt attributes from the HTML entirely. They all have different values and there are around 5000 of them, so clearly a straight find & replace isn't an option. Perhaps there's a way to find and replace with regex in Visual Web developer?

The tools/skills I have available are: HTML, Javascript, ASP (Classic), a little bit of .NET, Visual Web Developer Express 2010, but the only similar things I can find are PHP-based and they don't explain fully enough for me to set up a solution and feed the HTML to it.

I've found things like this: Regular expression to replace several html attributes, which give suggestions of regex functions which do similar things, but I'm not even sure how to run a regex function on a straight HTML file (my browser is struggling with the size of the HTML file as it is, so I don't think javascript is going to cut it).

Can anyone suggest the best way to accomplish this?

Thanks folks...

Upvotes: 0

Views: 639

Answers (1)

gitaarik
gitaarik

Reputation: 46300

Since you use Visual Studio, you can try the Regex search & replace option, though the implementation of regexes in Visual Studio is pretty different from other regex engines.

Here's a short article about it: http://www.codinghorror.com/blog/2006/07/the-visual-studio-ide-and-regular-expressions.html

As it says in the article, the builtin regex engine isn't ideal. They mention a plugin with implements standard regexes though: http://www.codeproject.com/Articles/9125/Standard-Regular-Expression-Searcher-Addin-For-VS

Upvotes: 1

Related Questions