Help With Migrating From eregi()

Discussion in 'PHP' started by ColorWP.com, May 17, 2010.

  1. #1
    Hello.

    How do I migrate this line in PHP so it does the same results, but is suitable for the latest version of PHP:
    $vbox7s = eregi('<div id="mainContainer" >(.*)</div>', $vbox7, $vbox7r);
    PHP:
    I consider myself pretty good with PHP, but I just suck at regular expression stuff. Currently, the above line issues a notice at the top of the page that the function is deprecated.

    Regards!
     
    ColorWP.com, May 17, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    Replace eregi with preg_match and add delimiters.

    $vbox7s = preg_match('~<div id="mainContainer" >(.*)</div>~', $vbox7, $vbox7r);
    PHP:
     
    danx10, May 17, 2010 IP
  3. vetrivel

    vetrivel Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What is the purpose of adding the delimiter(tilt )???

     
    vetrivel, May 17, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #4
    danx10, May 17, 2010 IP