Skip to content

Commit bcb4e7b

Browse files
committed
Fix link before a closed tag
1 parent 77df4c4 commit bcb4e7b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Autolink.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function convert($text, $attribs = array())
7272
{
7373
$self = $this;
7474

75-
echo $regex = "/(([a-zA-Z]*=\")*(" . $this->getSchemes(true) . ")\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?)/";
75+
$regex = "/(([a-zA-Z]*=\")*(" . $this->getSchemes(true) . ")\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}([\/a-zA-Z0-9\-._~:?#\[\]@!$&'()*+,;=%\">]*)?)/";
7676

7777
return preg_replace_callback(
7878
$regex,

test/AutolinkTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testConvert()
9494
<a href="http://example.com/path?foo[1]=a&foo[2]=b">http://example.com/path?foo[1]=a&foo[2]=b</a>
9595
<img src="http://example.com/path?foo[1]=a&foo[2]=b" width="100"/>
9696
<div data-target="http://example.com/path?foo[1]=a&foo[2]=b" wdith="100"/></div>
97-
<p>http://example.com/path?foo[1]=a&foo[2]=b</p>
97+
<p><a href="http://example.com/path?foo[1]=a&amp;foo[2]=b">http://example.com/path?foo[1]=a&amp;foo[2]=b</a></p>
9898
9999
HTML;
100100

@@ -258,6 +258,7 @@ public function testConvertEmail()
258258
<div data-target="sakura@flower.com" wdith="100"/></div>
259259
<div data-target="mailto:sakura@flower.com" wdith="100"/></div>
260260
261+
and emails are coming in between(salsan@lt.com).
261262
TEXT;
262263

263264
$html = <<<HTML

0 commit comments

Comments
 (0)