Jump to content

How to preg_match from the last preg_match result?


john_bboy7

Recommended Posts

I want to preg_match from the last result i got from preg_match. is it possible?

 

For example:

preg_match_all($pattern, $search , $matches1);
foreach($matches1[0] as $val1){
echo $val1 . "<br />\n";
}

 

Now i want to preg_match_all from the result i got in $val1 (From all matches)

so what will i put in place of $search this time in below line:

 

preg_match_all($pattern, $search , $matches1);

 

No $val1 doesnt works i tried.

Did you put the preg match all within the foreach loop?

 

Nope...infact i dont want it to be there.. the main view of my code is that i am extracting a piece of HTML first.. which will remove all the irrelevent stuff.

 

then i want to preg match from that piece of html.

 

And no i can not do it in first match as first match also contains the second match which i dont want it to b in..

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.