Fix autolinker regular expression to match test data
This commit is contained in:
parent
eec04b1864
commit
85609cd5e4
1 changed files with 2 additions and 7 deletions
|
@ -1275,20 +1275,15 @@ class BBCode extends BaseObject
|
||||||
( # Capture 1: entire matched URL
|
( # Capture 1: entire matched URL
|
||||||
https?:// # http or https protocol
|
https?:// # http or https protocol
|
||||||
(?:
|
(?:
|
||||||
www\d{0,3}[.] # "www.", "www1.", "www2." … "www999."
|
[^/.][^/]+[.][^/]+/? # looks like domain name followed by a slash
|
||||||
| # or
|
|
||||||
[a-z0-9.\-]+[.][a-z]{2,4}/ # looks like domain name followed by a slash
|
|
||||||
)
|
)
|
||||||
(?: # One or more:
|
(?: # One or more:
|
||||||
[^\s()<>]+ # Run of non-space, non-()<>
|
[^\s()<>]+ # Run of non-space, non-()<>
|
||||||
| # or
|
| # or
|
||||||
\(([^\s()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
|
\(([^\s()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
|
||||||
)+
|
|
||||||
(?: # End with:
|
|
||||||
\(([^\s()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
|
|
||||||
| # or
|
| # or
|
||||||
[^\s`!()\[\]{};:\'".,<>?«»“”‘’] # not a space or one of these punct chars
|
[^\s`!()\[\]{};:\'".,<>?«»“”‘’] # not a space or one of these punct chars
|
||||||
)
|
)*
|
||||||
)@';
|
)@';
|
||||||
$text = preg_replace($autolink_regex, '[url]$1[/url]', $text);
|
$text = preg_replace($autolink_regex, '[url]$1[/url]', $text);
|
||||||
if ($simple_html == 7) {
|
if ($simple_html == 7) {
|
||||||
|
|
Loading…
Reference in a new issue