Jump to content

Recommended Posts

I have searched a lot but no information about this aspect. I wonder how much heavy is the process of getting parts of a webpage by preg_match?

 

But my question is that which of these options are in favor of lighter CPU process:

 

1. getting each item between specified tags by a preg_match

or

2. First getting the content between <body>, then processing by php tools such as preg_match (again), explode, etc.

 

Thanks for considering this unusual question  :D

Link to comment
https://forums.phpfreaks.com/topic/232279-question-about-cpu-usage-by-preg_match/
Share on other sites

Hi,

 

you should query in the minimal content u can. If your parts in anywhere in the body get the entiry body and run the search loop in it. If those in a div get that div... Anyway regexp is not a fast method. You can use str pos in a loop, with the handy offset paramterer.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.