Skip to content
Snippets Groups Projects

F 344 extern linkify absorbs commas etc into link adress

1 file
+ 4
1
Compare changes
  • Side-by-side
  • Inline
+ 4
1
@@ -68,7 +68,10 @@ var cosmetics = new function () {
* @returns {string} text with <a> elements instead of raw links
*/
function linkify_string(text) {
const match_url_regex = /https?:\/\/[^\s]*\b(?![,:;?!])/gi;
// const match_url_regex = /https?:\/\/[^\s]*/g // original
// https://regexr.com helps you design regex
const match_url_regex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.?[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g
return text.replace(match_url_regex, function (href) {
var link_text = href;
if (_link_cut_off_length > 4 && link_text.length > _link_cut_off_length) {
Loading