Search and replace text in documents using wildcard

I have hundreds of html pages with tags that I need to get rid of. I can go thru each page and remove but that would take a very long time. Is there a way to use a wildcard to search and remove these tags? I've used the following when I know what the text is:

fileReader = My.Computer.FileSystem.ReadAllText("C:\Documents\Working\Content\" & strTag & "\" & strFile).Replace("<img src=""""*.jpg", strTag & "-" & strPhotoNum & ".jpg")

My.Computer.FileSystem.WriteAllText("C:\Documents\Working\Content\" & strTag & "\" & strFile, fileReader, False)

Can Regex be used to do this? if so can you point me to example?
Using VB.NET 2010
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian PringleSystems Analyst II, SCM, ERPCommented:
I use Notepad++ ( to do this.  Open all of the documents and then do "Find and Replace" (Ctrl+H).  It will allow you to find and replace among all of the documents that are open.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MadIceAuthor Commented:
I'll have to try that at home. I'll get back tomorrow.
        Dim jpgPattern = "(<img .+?src\s*=\s*[""'])(.*?.jpg)(['""].+?/>)"
        Dim testString = "some html text <img class=""someclass"" id='1' src='test.jpg' /> rest of html <img class=""someclass"" id='2' src = 'subfolder/test2.jpg' />"
        Dim regex = New System.Text.RegularExpressions.Regex(jpgPattern)
        MessageBox.Show(regex.Replace(testString, "$1New.jpg$3"))

Open in new window

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Terry WoodsIT GuruCommented:
Notepad++ allows you to find and replace by regex too... I second the idea that it's an appropriate tool for the job.
BTW, Total Commander as well as some other console-like apps ( including famous FAR) allow regex too ... :)
MadIceAuthor Commented:

Tried notepad ++ and home and was able to do what I needed using regex. Wasn't familiar with Notepad ++ or regex. I'm have software that has the regex feature already. Thanks for the info. Thanks to everyone else as well.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.