Results 1 to 2 of 2

Thread: Need Regex

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    Need Regex

    I need to remove the tag which has class value "footer_1". i struck with writing regex for this.

    Example.

    input :

    Code:
    <body>
    <a name="t1" id="pg-14-0"></a>
    <p id="pg-14-1">1<span class="chapter-body_13" id="pg-14-2">C H A P T E R</span></p>
    <p id="pg-14-3" class="footer_1">Why self-build, and why build green?</p>
    <a id="pg-14-3" class="footer_1">Why self-build, and why build green?</a>
    <p id="pg-14-4" class="chapter-body_15">Building your own home can be a very satisfying thing to do, and many people have gained a great sense of achievement from doing it..</p>
    </body>
    output:


    Code:
    <body>
    <a name="t1" id="pg-14-0"></a>
    <p id="pg-14-1">1<span class="chapter-body_13" id="pg-14-2">C H A P T E R</span></p>
    <p id="pg-14-4" class="chapter-body_15">Building your own home can be a very satisfying thing to do, and many people have gained a great sense of achievement from doing it..</p>
    </body>
    Visual Studio.net 2010
    If this post is useful, rate it


  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Need Regex

    Hey,

    Whenever it comes to parsing an HTML string, I always recommend the HTML Agility Pack:

    http://htmlagilitypack.codeplex.com/

    It does a lot of the hard work of working with the HTML string for you, meaning that you don't have to create the regex yourself.

    Hope that helps!

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width