Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RegEx: replace HTML block with specific text inside

Reply
Thread Tools

RegEx: replace HTML block with specific text inside

 
 
Claudio Biagioli
Guest
Posts: n/a
 
      02-06-2004
I have to replace a full HTML block (in this case a <TR>) which must contain
specific word(s).
Example
<tr>
<td>.... HELLO ....</td>
</tr>

must be substituted by another fixed string, but all other <tr> shouldn't
change.

I'm using RegEx.Replace but cannot find the correct Regular
Expression.

Any Idea?

Thanks!


 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmVyZW15?=
Guest
Posts: n/a
 
      02-06-2004
Well there is nothing like the feeling of creating your own regular expressions, so I would highly encourage it. http://www.regxlib.com/ is a pretty good site for learning how to create them

A while back I had a similiar problem where I needed to strip off "standard" HTML tags that every web page should have, so below is a sample of what I used to strip off the Title tag and everything inbetween. I would imagine that you can replace the (.*) with whatever you need and get it to work for you

(/<title>(.*)<\/title>\r\n/ig, "")

One catch though is that I created this for use in ASP and I've never used regular expressions in .NET (yet), so if you get this to work please let me know

Thanks
Jeremy
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace Text at Specific Positions Across Files Shiny Hydra Ruby 11 03-19-2010 05:33 PM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
Replace text inside html tags? squash@peoriadesignweb.com Perl Misc 4 01-31-2005 09:32 AM
How do you make sure a frameset is loaded? I'm trying to open a frameset in a new window which shows a specific html page in a specific frame ck388 Javascript 1 09-24-2003 08:32 PM



Advertisments