Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6542337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:12:51+00:00 2026-05-25T11:12:51+00:00

I have an HTML structure that is being pulled from an RSS feed, and

  • 0

I have an HTML structure that is being pulled from an RSS feed, and I need to remove part of it, but it is not a standalone part of the stream.

So I have

<p>Some Html... </p>
<br />
<p>The p section I want to remove</p>

Is there a regex pattern that can do this? find the last <p> segment of a given string and chop it out? I am using C# for the Regex.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:12:52+00:00Added an answer on May 25, 2026 at 11:12 am

    Are you sure you want to use Regex for this? Actually I think that you should use them only when you need to.

    Why don’t you consider something like (assuming the HTML is well formed and that there are not nested paragraphs):

    string html = GetRSS();
    int pStartIndex = html.LastIndexOf("<p>");
    int pEndIndex = html.LastIndexOf("</p>");
    string result = html.Remove(pStartIndex, pEndIndex - pStartIndex + 4);
    

    Alternatively you could consider using something more advanced (and maybe appropriate) like HTML Agility Pack or (worse if you are working with bad formed html) the integrated .NET XML parser (EDIT: As svicks says if you choose this solution please make sure that you are working with HTML that is also valid XML).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML structure being returned from an AJAX request... <th scope=col
I have some HTML that I need to toggle between two structures - one
I have this HTML structure and want to convert it to an accordion. <div
I have this HTML structure (excerpt): <td> <select id=test1 class=pub_chooser> <option value=99>All Publications</option> <option
I have a html structure like : <div onmouseover=enable_dropdown(1); onmouseout=disable_dropdown(1);> My Groups <a href=#>(view
I have the following html structure (which is generated and I can't change): <table
I have the following HTML structure: $('#subgroup a').nextUntil('h3').wrapAll('<div></div>'); <script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js></script> <div id=subgroup> <h3>Group name
I have the following HTML node structure: <div id=foo> <div id=bar></div> <div id=baz> <div
Child and descendant selectors have been leaking to every element on my html structure
I have some content sliding here. http://www.smallsharptools.com/downloads/jQuery/Slider/slider.html The HTML structure is simple. There is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.