Simplify web UI character counter logic (#4463)

lolsob-rspec
Eugen Rochko 2017-07-31 15:19:48 +02:00 committed by GitHub
parent 9e2971e899
commit 7ccb3a9d77
1 changed files with 1 additions and 1 deletions

View File

@ -2,6 +2,6 @@ const urlPlaceholder = 'xxxxxxxxxxxxxxxxxxxxxxx';
export function countableText(inputText) {
return inputText
.replace(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g, urlPlaceholder)
.replace(/https?:\/\/\S+/g, urlPlaceholder)
.replace(/(?:^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+)/ig, '@$2');
};