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 7593051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:04:10+00:00 2026-05-30T21:04:10+00:00

I have 1000 HTML documents, which inside I have $contenido=<p>TFJFA<div>whatsapp</div></p><p>second parragraph</p><p>third parragraph </p><p>night</p>; I

  • 0

I have 1000 HTML documents, which inside I have

$contenido="<p>TFJFA<div>whatsapp</div></p><p>second parragraph</p><p>third parragraph </p><p>night</p>";

I need to remove the first </p> tag; the result must be:

$contenido="<p>second parragraph</p><p>third parragraph </p><p>night</p>";

I’ve tried to use this regular expression, but it doesn’t work.

$pattern = '/\<p\>.*?\</p\>(.*)/';
$contenido=preg_replace($pattern, '$1'. $contenido);
  • 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-30T21:04:11+00:00Added an answer on May 30, 2026 at 9:04 pm

    Your pattern contains an un-escaped / within it, and you’re also using / as your regex delimiter (i.e. /regex/). You can either escape the internal / (in the closing tag) or use a different delimiter:

    $pattern = '/<p>.*?<\/p>(.*)/'; 
    

    OR (I like this option better, it’s easier to understand – I chose ‘@’ as the delimiter):

    $pattern = '@<p>.*?</p>(.*)@';
    

    Also, instead of replacing that with $1, you could just have your pattern as @<p>.*?</p>@, replace with '', and feed in 1 as the $limit argument to preg_replace.

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

Sidebar

Related Questions

i have this html code <div class=container id=container> <div class=post><h1>first title</h1>description here</div> <div class=post><h1>second
I have directory with > 1000 .html files, and would like to check all
Are there any html helpers for page navigation. eg. if i have 1000 records
I have 1000 rows of data but need to only display 100 rows at
Hi I have 1000 encrypted workbooks which I would like to decrypt by providing
I have the following query which have 1000 rows select staffdiscountstartdate,datediff(day,groupstartdate,staffdiscountstartdate), EmployeeID from tblEmployees
I have around 1000 pdf filesand I need to convert them to 300 dpi
I have many (about 1000) images (printscreens), and I need to crop these images
I have the 2 divs on a page which I need to animate up
I have the following script which I need to modify a little. Here 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.