eregi help needed

Discussion in 'PHP' started by phantom, Nov 11, 2007.

  1. #1
    How can I change this code below to only match everything between <starttag> and the first occurrence of </endtag> i.e in case there happened to be more than one </endtag> ?

    eregi('<starttag>(.*)</endtag>',$fcg,$got);
    Code (markup):


    Thanks in advance!
     
    phantom, Nov 11, 2007 IP
  2. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #2
    anybody have an idea?
     
    phantom, Nov 11, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    
    preg_match('~<starttag>(.*?)</endtag>~',$fcg,$got);
    
    PHP:
    Try to avoid ereg_* functions, as they're about 6 times slower than preg_* functions.
     
    nico_swd, Nov 12, 2007 IP
  4. phantom

    phantom Well-Known Member

    Messages:
    1,509
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    140
    #4
    As always......Thanks nico.....I wish you lived next door :)
     
    phantom, Nov 12, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    We're all virtual neighbors. :)
     
    nico_swd, Nov 12, 2007 IP