File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -209,4 +209,14 @@ describe("autolinker", function () {
209209 ] ,
210210 ] ) ;
211211 } ) ;
212+
213+ it ( "should correctly find emails with hyphens in domain (bug 20557)" , function ( ) {
214+ testLinks ( [
215+ [
216+ "john.doe@faculity.uni-cityname.tld" ,
217+ "mailto:john.doe@faculity.uni-cityname.tld" ,
218+ ] ,
219+ [ "john.doe@uni-cityname.tld" , "mailto:john.doe@uni-cityname.tld" ] ,
220+ ] ) ;
221+ } ) ;
212222} ) ;
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ class Autolinker {
138138 static findLinks ( text ) {
139139 // Regex can be tested and verified at https://regex101.com/r/rXoLiT/2.
140140 this . #regex ??=
141- / \b (?: h t t p s ? : \/ \/ | m a i l t o : | w w w \. ) (?: [ \S - - [ \p{ P} < > ] ] | \/ | [ \S - - [ \[ \] ] ] + [ \S - - [ \p{ P} < > ] ] ) + | (? = \p{ L} ) [ \S - - [ @ \p{ Ps} \p{ Pe} < > ] ] + @ ( [ \S - - [ \p{ P} < > ] ] + (?: \. [ \S - - [ \p{ P} < > ] ] + ) + ) / gmv;
141+ / \b (?: h t t p s ? : \/ \/ | m a i l t o : | w w w \. ) (?: [ \S - - [ \p{ P} < > ] ] | \/ | [ \S - - [ \[ \] ] ] + [ \S - - [ \p{ P} < > ] ] ) + | (? = \p{ L} ) [ \S - - [ @ \p{ Ps} \p{ Pe} < > ] ] + @ ( [ \S - - [ [ \p{ P} - - \- ] < > ] ] + (?: \. [ \S - - [ [ \p{ P} - - \- ] < > ] ] + ) + ) / gmv;
142142
143143 const [ normalizedText , diffs ] = normalize ( text , { ignoreDashEOL : true } ) ;
144144 const matches = normalizedText . matchAll ( this . #regex) ;
You can’t perform that action at this time.
0 commit comments