Stop matching the second word starting with @ in a mention
authorTim Düsterhus <timwolla@googlemail.com>
Tue, 19 Jul 2016 22:23:43 +0000 (00:23 +0200)
committerGitHub <noreply@github.com>
Tue, 19 Jul 2016 22:23:43 +0000 (00:23 +0200)
This allow mentions like: @Example @TimWolla Look there!

wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php

index 9a68014fc90454d7a2902f0261908aaadb00df00..f6374ac7d2fac7c30de513d7ed41b9903d57de77 100644 (file)
@@ -35,11 +35,13 @@ class PreParserAtUserListener implements IParameterizedEventListener {
                                (?:^|(?<=\s|\]))                                        # either at start of string, or after whitespace
                                @
                                (
-                                       ([^',\s][^,\s]{2,})(?:\s[^,\s]+)?       # either at most two strings, not containing
-                                                                               # whitespace or the comma, not starting with a single quote
-                                                                               # separated by a single whitespace character
+                                       ([^',\s][^,\s]{2,})(?:\s[^@,\s][^,\s]*)?        # either at most two strings,
+                                                                                       # not containing the whitespace or the comma,
+                                                                                       # not starting with a single quote
+                                                                                       # the second string not starting with the at sign
+                                                                                       # separated by a single whitespace character
                                |
-                                       '(?:''|[^']){3,}'                       # or a string delimited by single quotes
+                                       '(?:''|[^']){3,}'                               # or a string delimited by single quotes
                                )
                        ", Regex::IGNORE_WHITESPACE);
                }