Skip to content

Commit

Permalink
Regex modified to to not capture brackets
Browse files Browse the repository at this point in the history
Modified the existing regex from th TLD onwards

Credit to @gruber for the regex info
https://gist.github.com/gruber/249502
  • Loading branch information
robmcvey committed Jan 2, 2015
1 parent 2bf41f3 commit 54e172b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/TextHelper.php
Expand Up @@ -107,7 +107,7 @@ public function autoLinkUrls($text, $options = array()) {
$this->_placeholders = array();
$options += array('escape' => true);

$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[\p{L}0-9.\-_:]+(?:[/?][^\s<]*)?)#ui';
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[\p{L}0-9.\-_:]+(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))#i';
$text = preg_replace_callback(
$pattern,
array(&$this, '_insertPlaceHolder'),
Expand Down

0 comments on commit 54e172b

Please sign in to comment.