Чуть доработал парсер урлов - теперь точка в конце урла игнорится

This commit is contained in:
Krivchikov Dmitry 2015-09-12 13:16:35 +03:00
parent 84ec7e2268
commit 68e785a262
2 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class Markdown
static private function replaceUrls($string) static private function replaceUrls($string)
{ {
$pr = '((https{0,1}:\/\/[\da-z\.-]+\.[a-z]{2,6})[\/\w\?=&#%+\.,-]*\/?)'; $pr = '((https{0,1}:\/\/[\da-z\.-]+\.[a-z]{2,6})([\/\w\?=&#%+,-]|(\.[^\s]))*\/?)';
$rep = '<a href="$0" title="$0" target="_blank">$1</a>'; $rep = '<a href="$0" title="$0" target="_blank">$1</a>';
return preg_replace($pr, $rep, $string); return preg_replace($pr, $rep, $string);
} }

View File

@ -71,7 +71,7 @@
<textarea name="text" id="articleText" class="form-control" onscroll="monitor.scrollTop=scrollTop" style="height: 500px; resize: none;" ><?= $article->text ?></textarea> <textarea name="text" id="articleText" class="form-control" onscroll="monitor.scrollTop=scrollTop" style="height: 500px; resize: none;" ><?= $article->text ?></textarea>
</td> </td>
<td style="width: 50%;"> <td style="width: 50%;">
<div id="monitor" style="height: 500px; width: 100%; background-color: white; margin-top: 25px; overflow-y: scroll;"></div> <div id="monitor" style="height: 500px; width: 100%; background-color: white; margin-top: 25px; overflow-y: scroll; padding: 5px 10px;"></div>
</td> </td>
</tr> </tr>
</table> </table>