RegEx: replace HTML block with specific text inside

Discussion in 'ASP .Net' started by Claudio Biagioli, Feb 6, 2004.

  1. 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!
     
    Claudio Biagioli, Feb 6, 2004
    #1
    1. Advertising

  2. 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
     
    =?Utf-8?B?SmVyZW15?=, Feb 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. morrell
    Replies:
    1
    Views:
    999
    roy axenov
    Oct 10, 2006
  2. Replies:
    3
    Views:
    822
    Reedick, Andrew
    Jul 1, 2008
  3. Shiny Hydra
    Replies:
    11
    Views:
    204
    Robert Klemme
    Mar 19, 2010
  4. Replies:
    4
    Views:
    208
    Bart Lateur
    Jan 31, 2005
  5. mscir
    Replies:
    0
    Views:
    332
    mscir
    Oct 12, 2005
Loading...

Share This Page