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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:33:10+00:00 2026-06-15T00:33:10+00:00

I wanna replace all date with a space from the fetched content using SIMPLE

  • 0

I wanna replace all date with a space from the fetched content using SIMPLE HTML PHP DOM PARSER (simplehtmldom.sourceforge.net). Here is the code:

include("simple_html_php_dom.php");
$html = file_get_html("http://freebacklinks.prijm.com"); //example.com
$result = "$html";
$result = preg_replace("/([1-9]|[0-2][0-9]|3[0-1]) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{4}/", " ", $result);
$result = preg_replace("/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([1-9]|[0-2][0-9]|3[0-1]) [0-9]{4}/", " ", $result);
echo $result;

So, here all date data like: 01 Jan 2004 or Jan 01 2004 or Dec 12 14 should be replaced by a space… But its not replacing those date with space.. Now what to do?
Here is a example showing how it will work.. http://codepad.org/lAuHW565 but why its not working in PHP Simple HTML DOM Parser

  • 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-06-15T00:33:12+00:00Added an answer on June 15, 2026 at 12:33 am

    You’re trying to replace on a SimpleHTML object which is impossible (it’s an object, not a string). What you should do is first get the HTML, then replace, and then turn it into SimpleHTML using the str_get_html function.

    <?php
        include("simple_html_php_dom.php");
    
        //Start with getting the pure HTML and replacing in that (don't use SimpleHTMLPHP for this)
        $html = file_get_contents("http://freebacklinks.prijm.com"); //example.com
        $html= preg_replace("/([1-9]|[0-2][0-9]|3[0-1])\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+[0-9]{4}/", " ", $html);
        $html = preg_replace("/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+([1-9]|[0-2][0-9]|3[0-1])\s+[0-9]{4}/", " ", $html);
    
        //Now create the $result variable:
        $result = str_get_html($html);
        echo $result;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna run selenium tests from TeamCity using Maven at Linux server without display.
I wanna replace several words in a text using replace() in javascript, how can
ok i have this and it doesn't show all the rows when fetched from
i am getting data from XML into html using jquery, i build a function
I wanna use powershell to get all the file in sharepoint library EM_DOC_LIBRARY and
I wanna preg replace anything inbetween (THIS) those two bracket thingys I want to
I'm using PHP, jQuery and mySQL to build an admin site to my webpage.
I am writing a simple parser for C. I was just running it with
I want to replace all double tokens in string with the double value appended
So i wanna do something like this in php. If i have a year

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.