Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Javascript to replace "~~" to html strikethrough tags.
let string = "~~test string~~";
let i = 0;
string = string.replace(new RegExp("~~", 'g'), c => ++i % 2 ? "<s>" : "</s>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.