small alteration to preg_match_all expression

Discussion in 'PHP' started by stephan2307, Jun 11, 2010.

  1. #1
    I have the following expression which fetches all links of a website.

    /<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>/siU
    PHP:
    At the moment it can detect links if href is encapsulated by "" or nothing. However I want it to also work for ''. How can I do that?
     
    stephan2307, Jun 11, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    Maybe:
    
    [\"\'\s]
    
    PHP:
     
    MyVodaFone, Jun 11, 2010 IP
  3. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #3
    Thanks got it to work
     
    stephan2307, Jun 11, 2010 IP