Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save baptistemanson/7ce05c80e557b8d127cd7e2c4813771f to your computer and use it in GitHub Desktop.
Save baptistemanson/7ce05c80e557b8d127cd7e2c4813771f to your computer and use it in GitHub Desktop.
remove-mentions.js
const test = `f notification shows [@jane](http://staging/uuid) sdfjhabsdfan sf asdfjknsadf sad ff notification
shows [@hector](http://staging/3fd21asd32sa1f3as2d1fas32fd1a-asdfasdfa2sdf)`;
const result = `f notification shows @jane sdfjhabsdfan sf asdfjknsadf sad ff notification
shows @hector`;
const reg = /\[(@[^\]]*)\]\([^)]*\)/gm;
const testResult = test.replace(reg, "$1");
console.log(result === testResult);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment