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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:21:28+00:00 2026-05-28T05:21:28+00:00

Problem One: </a> 19-10-2011, 04:49 PM </td> <td class=thread How to fetch the DATE

  • 0

Problem One:

</a>              

19-10-2011, 04:49 PM

             </td> <td class="thread" 

How to fetch the DATE and TIME i.e. 19-10-2011, 04:49 PM

Note: the above snippet could have unstable spacing as you see above e.g. </td> <td class

My attempt:

preg_match("#</a>(.*?)</td> <td class=\"thread\"#", $page, $fetchContent);

Result: empty


Problem Two:

<div id="post_message_43345">ANY TYPE OF CONTENT INCLUDING SPACES</tr> <tr>

I need to fetch “ANY TYPE OF CONTENT”.

Note: the spacing between tags such as </tr> <tr> could vary from page to another.

My attempt:

preg_match("#<div id=\"post_message_[a-zA-Z0-9_]*\">(.*?)</tr> <tr>#", $page, $fetchedContent);

Result: empty

I’m looking for rough temporary short snippet for one task. Therefore, i didn’t use HTML parser.

Any help will be appreciated.

  • 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-28T05:21:29+00:00Added an answer on May 28, 2026 at 5:21 am

    Problem 1

    You need to use the s flag to have . match newline characters too:

    preg_match("#</a>(.*?)</td> <td class=\"thread\"#s", $page, $fetchContent);
    

    You’d probably be better off matching the date directly though:

    preg_match("#([0123]?[0-9]-(?:0?[1-9]|1[012])-(?:[0-9]{4})),? ?((?:0[0-9]|1[012]):[0-5][0-9] ?[AP]M)#",...)
    

    edit – this date regex will be a little faster (added boundaries either side):

    preg_match("#\\b([0123]?[0-9]-(?:0?[1-9]|1[012])-(?:[0-9]{4}))[, ]{1,3}((?:0[0-9]|1[012]):[0-5][0-9] ?[AP]M)\\b#",...)
    

    For both, the date is in $results[1] and the time is in $results[2].

    Problem 2

    Again the s flag, and to have varying spaces between the </tr> <tr> use *.

    preg_match("#<div id=\"post_message_[a-zA-Z0-9_]*\">(.*?)</tr> *<tr>#s", $page, $fetchedContent);
    

    If you want to allow for newlines between the </tr> and <tr> then do \s* instead. Same for Problem 1.

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

Sidebar

Related Questions

i have one problem with handling list,i have three class named as UserInf,userData,userProcess,i created
Problem One friend suggested an interesting problem. Given the following code: public class OuterClass
I have one problem with parsing *.docx document with OpenXML (C#). So, here's my
I have one problem with Javascript Nodes.I want to find out what button was
I have one problem , I want to get some data from XML file
I have one problem, I learn how work with socket and I write programm
I have an interesting problem in one of my C++ programs. Apperantly the vtable
I have a strange problem...I have a MySql db with some columns and one
This is a problem one of our developers brought to me. He stumbled across
Im facing one problem in streaming data capture for reading the broadcast data during

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.