Jump to content

ergei to preg_match


lordshoa

Recommended Posts

they just hold a $var that is the start for the search and the end of the search

 

So If i was searching in a txt file it would look for the  the word start say

 

$begining - 'start';

$finish = 'end';

 

search for the word start  hold everything in between untill you find the word end from the file $stuff add eveything inbetween to the var $cont

Link to comment
https://forums.phpfreaks.com/topic/265671-ergei-to-preg_match/#findComment-1361518
Share on other sites

Only thing really to add to scootah's code is the i modifier, since eregi is case-insensitive.  Also

 

$begin = preg_quote($begin,"/");
$finish = preg_quote($finish,"/");
preg_match("/$begin(.*)$finish/i", $stuff, $cont);

 

edit: I had edited to add preg_quote at same time as xyph's post!

Link to comment
https://forums.phpfreaks.com/topic/265671-ergei-to-preg_match/#findComment-1361590
Share on other sites

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.