Jump to content

regexpr help


nullified

Recommended Posts

 

Im trying to figure out regexpr but after a lot of reading and trial and error i think a real world e.g. maybe usefull for my dumbness :)

 

i would like to change this to use regexpr, does anyone have an e.g. or can anyone provide assistance.

 

function gethtml($search)
{

    // find out the first occurence of "</tr" and throw the superfluos stuff in front of it away
    $string = strchr($string, '</tr>');
    $string = str_replace('</td>', '|', $string);
    $string = str_replace('</tr>', '§', $string);
    $string = chop(strip_tags($string));
    $pieces = explode("§", $string);
    foreach($pieces as $val) {
        $bits = explode("|", $val);
        if (strchr($bits[0], $search)) {
            return $bits;
        }
    }
}

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/102979-regexpr-help/
Share on other sites

just want to learn regexpr thats all and ive been told its better done with regexpr.....and sorry just figured it should be under php.....someone move it if they like.

 

I am pretty sure that this is probably better done your way, and this would take you longer to learn with regex unless you learned more of the basics, and tried to grasp some regex.

Link to comment
https://forums.phpfreaks.com/topic/102979-regexpr-help/#findComment-527554
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.