Skip to content

Commit

Permalink
Detect preceding whitespace for users in linkify (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
titantwentyone authored Jun 30, 2022
1 parent b1804ce commit b324160
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ApiV1/Traits/FormattingHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function linkify(
$patterns = [];
$patterns['url'] = '(?xi)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))';
$patterns['mailto'] = '([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3}))';
$patterns['user'] = '(?: +|^)@([A-Za-z0-9_]*)?';
$patterns['user'] = '(?:\s+|^)@([A-Za-z0-9_]*)?';
$patterns['hashtag'] = '(?:(?<=\s)|^)#(\w*[\p{L}\-\d\p{Cyrillic}\d]+\w*)';
$patterns['long_url'] = '>(([[:alnum:]]+:\/\/)|www\.)?([^[:space:]]{12,22})([^[:space:]]*)([^[:space:]]{12,22})([[:alnum:]#?\/&=])<';

Expand Down

0 comments on commit b324160

Please sign in to comment.