Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/matcher/url-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class UrlMatcher extends Matcher {

// Allow optional path, query string, and hash anchor, not ending in the following characters: "?!:,.;"
// http://blog.codinghorror.com/the-problem-with-urls/
urlSuffixRegex = new RegExp( '[/?#](?:[' + alphaNumericAndMarksCharsStr + '\\-+&@#/%=~_()|\'$*\\[\\]?!:,.;\u2713]*[' + alphaNumericAndMarksCharsStr + '\\-+&@#/%=~_()|\'$*\\[\\]\u2713])?' );
urlSuffixRegex = new RegExp( '[/?#](?:[' + alphaNumericAndMarksCharsStr + '\\-^+&@#/%=~_()|\'$*\\[\\]?!:,.;\u2713]*[' + alphaNumericAndMarksCharsStr + '\\-^+&@#/%=~_()|\'$*\\[\\]\u2713])?' );

return new RegExp( [
'(?:', // parens to cover match for scheme (optional), and domain
Expand Down
23 changes: 23 additions & 0 deletions tests/matcher/url-matcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,29 @@ describe( "Autolinker.matcher.Url", function() {
expect( othermatches.length ).toBe( 1 );
});

it( 'should match the entire URL with a single ^ in a parameter', function() {
let matches = matcher.parseMatches( 'https://google.fr/path?parameter=^value12345' );
let othermatches = matcher.parseMatches( 'https://google.fr/path?parameter=value^12345' );


expect( matches.length ).toBe( 1 );
MatchChecker.expectUrlMatch( matches[ 0 ], 'https://google.fr/path?parameter=^value12345', 0 );


expect( othermatches.length ).toBe( 1 );
MatchChecker.expectUrlMatch( othermatches[ 0 ], 'https://google.fr/path?parameter=value^12345', 0 );
});

it( 'should match the entire URL with multiple ^ in a parameter', function() {
let matches = matcher.parseMatches( 'https://google.fr/path?parameter=^value1&parameter2=value^2' );



expect( matches.length ).toBe( 1 );
MatchChecker.expectUrlMatch( matches[ 0 ], 'https://google.fr/path?parameter=^value1&parameter2=value^2' , 0 );
});



it( 'should match katakana with dakuten characters (symbol with combining mark - two unicode characters)', function() {
var matches = matcher.parseMatches( 'https://website.com/files/name-ボ.pdf' );
Expand Down