Reg-Exp for Link issue

Discussion in 'PHP' started by Shoe ButtBack, Mar 21, 2010.

  1. #1
    Hi,

    I need to get all links that are not of a certain domain.

    How would the reg-exp look for it?

    Is there a way of negating a sequence of characters? so something like [^domain.com]* ?

    Armin
     
    Shoe ButtBack, Mar 21, 2010 IP
  2. hugsbunny

    hugsbunny Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    get all domains and remove this specific domain
     
    hugsbunny, Mar 21, 2010 IP
  3. hugsbunny

    hugsbunny Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think you can use ( ) not []
     
    hugsbunny, Mar 21, 2010 IP
  4. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The four lookaround expressions are
    (?=) - Positive look ahead
    (?!) - Negative look ahead
    (?<=) - Positive look behind
    (?<!) - Negative look behind

    You should take a look into those if you want to check for strings of text in your domains
    I would personally use the DOM to get all links since it's more accurate (take a look here on the dom method of getting links: http://www.jaygilford.com/php/php-dom-get-all-pagelinks/)
     
    JAY6390, Mar 21, 2010 IP