src/Luminous/Formatters/HtmlFormatter.php
protected function linkify($src)
    {
        if (stripos($src, "http") === false && stripos($src, "www") === false) {
            return $src;
        }

        $chars = "0-9a-zA-Z\$\-_\.+!\*,%";
        $src_ = $src;
        // everyone stand back, I know regular expressions
        $src = preg_replace_callback(
            "@(?<![\w])
            (?:(https?://(?:www[0-9]*\.)?) | (?:www\d*\.)   )

            # domain and tld
            (?:[$chars]+)+\.[$chars]{2,}
            # we don't include tags at the EOL because these are likely to be
            # line-enclosing tags.
            (?:[/$chars/?=\#;]+|&amp;|<[^>]+>(?!$))*
            @xm",
            array($this, 'linkifyCb'),
            $src
        );
        // this can hit a backtracking limit, in which case it nulls our string
        // FIXME: see if we can make the above regex more resiliant wrt
        // backtracking
        if (preg_last_error() !== PREG_NO_ERROR) {
            $src = $src_;
        }
        return $src;
    }
protected function linkify($src)
    {
        if (stripos($src, "http") === false && stripos($src, "www") === false) {
            return $src;
        }

        $chars = "0-9a-zA-Z\$\-_\.+!\*,%";
        $src_ = $src;
        // everyone stand back, I know regular expressions
        $src = preg_replace_callback(
            "@(?<![\w])
            (?:(https?://(?:www[0-9]*\.)?) | (?:www\d*\.)   )

            # domain and tld
            (?:[$chars]+)+\.[$chars]{2,}
            # we don't include tags at the EOL because these are likely to be
            # line-enclosing tags.
            (?:[/$chars/?=\#;]+|&amp;|<[^>]+>(?!$))*
            @xm",
            array($this, 'linkifyCb'),
            $src
        );
        // this can hit a backtracking limit, in which case it nulls our string
        // FIXME: see if we can make the above regex more resiliant wrt
        // backtracking
        if (preg_last_error() !== PREG_NO_ERROR) {
            $src = $src_;
        }
        return $src;
    }
protected function linkify ( $ src ) { if ( stripos ( $ src , "http" ) === false && stripos ( $ src , "www" ) === false ) { return $ src ; } $ chars = "0-9a-zA-Z\$\-_\.+!\*,%" ; $ src_ = $ src ; // everyone stand back, I know regular expressions $ src = preg_replace_callback ( "@(?<![\w])
            (?:(https?://(?:www[0-9]*\.)?) | (?:www\d*\.)   )

            # domain and tld
            (?:[$chars]+)+\.[$chars]{2,}
            # we don't include tags at the EOL because these are likely to be
            # line-enclosing tags.
            (?:[/$chars/?=\#;]+|&amp;|<[^>]+>(?!$))*
            @xm" , array ( $ this , 'linkifyCb' ) , $ src ) ; // this can hit a backtracking limit, in which case it nulls our string // FIXME: see if we can make the above regex more resiliant wrt // backtracking if ( preg_last_error ( ) !== PREG_NO_ERROR ) { $ src = $ src_ ; } return $ src ; }
Detects and links URLs
Detects and links URLs