Created
November 5, 2020 09:33
-
-
Save Shilo/3827de1c4532bb1fe22c34bb11cce452 to your computer and use it in GitHub Desktop.
Javascript to replace "~~" to html strikethrough tags.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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