~cytrogen/masto-fe

ref: 20a89f1c8eefa0f766a4650be4d2e5f1fa92ee71 masto-fe/app/javascript/flavours/glitch/features/compose/util/counter.js -rw-r--r-- 272 bytes
20a89f1c — Cytrogen [feature] Bookmark folders UI a month ago
                                                                                
1
2
3
4
5
6
7
8
9
import { urlRegex } from "./url_regex";

const urlPlaceholder = "$2xxxxxxxxxxxxxxxxxxxxxxx";

export function countableText(inputText) {
  return inputText
    .replace(urlRegex, urlPlaceholder)
    .replace(/(^|[^/\w])@(([a-z0-9_]+)@[a-z0-9.-]+[a-z0-9]+)/ig, "$1@$3");
}