?
Solved

Parse out HTML tags with VB.Net and Regular Expressions

Posted on 2009-07-12
5
Medium Priority
?
708 Views
Last Modified: 2012-05-07
I have string that is an HTML page from my DB. What I want to do is search through the string and get all <img tags that have the height or width set, and change the src on each of them. I am not very good with Regular Expressions so I was hoping someone out there could help me out.
0
Comment
Question by:johnywhite
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 24837259
Hi johnywhite;

Can you post some actual samples of the img tags?

Also:
Will the height always come before the width or the other way around or in any sequence?
Will there be other attributes with the image tag? if so what order will they be in respect to height and width?
Is the part of the source that will change be the same and will the replacement be the same?

In order to do what you want the exact pattern of what must be changed must be known and what to change must be known. So can you give a specification.

Thanks;
Fernando
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 24838062
If using regular expressions is not a requirement then the following links could be useful

http://www.codeproject.com/KB/vb/Parsing_HTML.aspx

http://www.codeguru.com/vb/vb_internet/html/article.php/c4815
0
 

Author Comment

by:johnywhite
ID: 24865614
CodeCruiser I like that method. Thanks!
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24867289
You are welcome.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question