Exclude `?`, `!`, and `)` from last character of URL
Now the final character in each of these example strings is no longer considered part of the URL: * Have you seen http://example.com? * Look at http://example.com! * (see http://example.com)pull/4566/head
parent
7e8de5540f
commit
7d23278ed0
|
@ -63,7 +63,7 @@ const urlRegex = (() => {
|
|||
const urlChar = `[-:@_.,~%+/?=&#!;()$${wordCharRegex.source.slice(1, -1)}]`;
|
||||
// Matches a single character that should not be considered part of the URL if it is the last
|
||||
// character that matches urlChar.
|
||||
const postUrlPunct = '[:.,;]';
|
||||
const postUrlPunct = '[:.,;?!)]';
|
||||
// Schemes that must be followed by ://
|
||||
const withAuth = `(?:${[
|
||||
'(?:x-)?man',
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('urls', function () {
|
|||
});
|
||||
|
||||
describe('punctuation after URL is ignored', function () {
|
||||
for (const char of ':.,;]') {
|
||||
for (const char of ':.,;?!)]') {
|
||||
const want = 'https://etherpad.org';
|
||||
const input = want + char;
|
||||
it(input, async function () {
|
||||
|
|
Loading…
Reference in New Issue