preg_match_all?

Discussion in 'PHP' started by Supah!, Dec 3, 2008.

  1. #1
    seem right?

    
    $pattern = '/^<h3 class=r>*</h3>/'; 
    Code (markup):

     
    Supah!, Dec 3, 2008 IP
  2. zdrol

    zdrol Peon

    Messages:
    19
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Depends on what you are trying to do, but I'd probably say this is closer to what you want.
    
    $pattern = '/<h3 class=r>.*<\/h3>/';
    
    Code (markup):
     
    zdrol, Dec 3, 2008 IP
  3. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #3
    Accounts for other HTML like <span> inside the <h3>
    '#<h3 class=r>(.+(?!/h3>))</h3>#i'
    Code (markup):
    Assumes there's no HTML inside the <h3>
    '#<h3 class=r>([^<]+)</h3>#i'
    Code (markup):
    It would be best if you posted as many examples of what this should be matched against as possible.
     
    joebert, Dec 3, 2008 IP
  4. Supah!

    Supah! Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thanks alot guys!
     
    Supah!, Dec 4, 2008 IP