Skip to content

Commit efd86fc

Browse files
committed
Merge branch 'dmatteo-apostrophe.fix'
2 parents 5b1f9c6 + 56caa63 commit efd86fc

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

dist/Autolinker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2867,7 +2867,7 @@ Autolinker.matcher.Email = Autolinker.Util.extend( Autolinker.matcher.Matcher, {
28672867
*/
28682868
matcherRegex : (function() {
28692869
var alphaNumericChars = Autolinker.RegexLib.alphaNumericCharsStr,
2870-
emailRegex = new RegExp( '[' + alphaNumericChars + '\\-\\_;:&=+$.,]+@' ), // something@ for email addresses (a.k.a. local-part)
2870+
emailRegex = new RegExp( '[' + alphaNumericChars + '\\-_\';:&=+$.,]+@' ), // something@ for email addresses (a.k.a. local-part)
28712871
domainNameRegex = Autolinker.RegexLib.domainNameRegex,
28722872
tldRegex = Autolinker.RegexLib.tldRegex; // match our known top level domains (TLDs)
28732873

dist/Autolinker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/matcher/Email.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Autolinker.matcher.Email = Autolinker.Util.extend( Autolinker.matcher.Matcher, {
1919
*/
2020
matcherRegex : (function() {
2121
var alphaNumericChars = Autolinker.RegexLib.alphaNumericCharsStr,
22-
emailRegex = new RegExp( '[' + alphaNumericChars + '\\-\\_;:&=+$.,]+@' ), // something@ for email addresses (a.k.a. local-part)
22+
emailRegex = new RegExp( '[' + alphaNumericChars + '\\-_\';:&=+$.,]+@' ), // something@ for email addresses (a.k.a. local-part)
2323
domainNameRegex = Autolinker.RegexLib.domainNameRegex,
2424
tldRegex = Autolinker.RegexLib.tldRegex; // match our known top level domains (TLDs)
2525

tests/AutolinkerSpec.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,12 +835,18 @@ describe( "Autolinker", function() {
835835
} );
836836

837837

838-
it( "should properly link an email address with underscopres", function() {
838+
it( "should properly link an email address with underscores", function() {
839839
var result = autolinker.link( "Joe's email is ([email protected])" );
840840
expect( result ).toBe( 'Joe\'s email is (<a href="mailto:[email protected]">[email protected]</a>)' );
841841
} );
842842

843843

844+
it( "should properly link an email address with an apostrophe", function() {
845+
var result = autolinker.link( "Joe's email is (joe'[email protected])" );
846+
expect( result ).toBe( 'Joe\'s email is (<a href="mailto:joe\'[email protected]">joe\'[email protected]</a>)' );
847+
} );
848+
849+
844850
it( "should automatically link an email address with accented characters", function() {
845851
var result = autolinker.link( "Joe's email is mañana@mañana.com" );
846852
expect( result ).toBe( 'Joe\'s email is <a href="mailto:mañana@mañana.com">mañana@mañana.com</a>' );

tests/matcher/EmailSpec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ describe( "Autolinker.matcher.Email", function() {
6868
MatchChecker.expectEmailMatch( matches[ 0 ], '[email protected]', 6 );
6969
} );
7070

71+
72+
it( 'a match with an \' should be parsed correctly', function() {
73+
var matches = matcher.parseMatches( 'o\'[email protected]' );
74+
75+
expect( matches.length ).toBe( 1 );
76+
MatchChecker.expectEmailMatch( matches[ 0 ], 'o\'[email protected]', 0 );
77+
} );
78+
7179
} );
7280

7381

0 commit comments

Comments
 (0)