combining 2 regexs in 1 pattern..

Discussion in 'PHP' started by linkinpark2014, Jul 16, 2008.

  1. #1
    I have little problem..
    I just want to combine two regular expressions into 1 regex pattern
    okay here is the code snippets:

    my 1st regex:
    preg_match_all('/(<span class=\"competition\">(.*?)<\/span>)/',$result,$out))
    
    Code (markup):
    2nd regex:
    if(preg_match_all('/<a\s+.*?href=[\"\']?([^\"\' >]*)[\"\']?[^>]*>(Play)<\/a>/i',$result,$out))
    
    Code (markup):
    then I combined them into 1 pattern:

    if(preg_match_all('/(<span class=\"competition\">(.*?)<\/span>).*?(<a\s+.*?href=[\"\']?([^\"\' >]*)[\"\']?[^>]*>(Play)<\/a>)/i',$result,$out))
    
    Code (markup):
    when I run it I get an empty array..
    but when I run the both sepertly I get the result..
    so Is there any way that I can combine both regex?
     
    linkinpark2014, Jul 16, 2008 IP
  2. linkinpark2014

    linkinpark2014 Peon

    Messages:
    153
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    so guyz can I use <a href> regex with <span> tag regex??
    I used <span> with other <span> and with other <td> and everything worx great..
    the problem is with <a href> tag..

    so any ideas?
     
    linkinpark2014, Jul 16, 2008 IP