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
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
Share on other sites

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.