Autolinker.js icon indicating copy to clipboard operation
Autolinker.js copied to clipboard

Wrong result when parsing CJK(中文/日文/韩文) char followed by colon

Open mercury233 opened this issue 2 years ago • 1 comments

const Autolinker = require("autolinker")
const autolinker = new Autolinker({
	urls: {
		schemeMatches: true,
		tldMatches: false,
		ipV4Matches: false
	},
	newWindow: false,
	stripPrefix: false,
	email: false,
	phone: false,
	stripTrailingSlash: false
});

console.log(autolinker.link("链接:https://www.google.com"));
console.log(autolinker.link("link:https://www.google.com"));
console.log(autolinker.link("链接: https://www.google.com"));
console.log(autolinker.link("链接:https://www.google.com"));

image

https://runkit.com/embed/xpmv085le79y

The 4th result is wrong

mercury233 avatar Nov 09 '22 15:11 mercury233

Similar example here.

console.log(Autolinker.link("こちら→https://google.com"))
// result: こちら→https://g<a href="http://oogle.com" target="_blank" rel="noopener noreferrer">oogle.com</a>

keisukekomeda avatar Mar 13 '23 08:03 keisukekomeda