#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    113
    Rep Power
    10

    Ignore link in certain format


    Hi regex masters!


    Having this regex expression
    /((http(s?):\\/\\/{1}\S+))/
    it allows to fetch a link from a text string

    PHP Code:
    $string 'asdsa asdsa http://www.google.com asdasd';
    // link to be fetched by the regex

    $pattern '/((http(s?):\\/\\/{1}\S+))/';
    preg_match($pattern$string$match); 


    However, I would like to improve it in order to igonore the following link in $string = '[abc](http://www.google.com "def")'


    PHP Code:
    $string '[abc](http://www.google.com "def")';
    // link to be IGNORED by the regex

    $pattern '/((http(s?):\\/\\/{1}\S+))/';
    preg_match($pattern$string$match); 

    Many thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2004
    Posts
    113
    Rep Power
    10
    Something like ignoring this...

    PHP Code:
    (\\[.*\])\\(((http(s?):\\/\\/{1}\S+)) \\"(.*)\\"\\) 
    [abc](http://www.google.com "def")

    but fetching all others links in a string

IMN logo majestic logo threadwatch logo seochat tools logo