Created
September 29, 2020 10:05
-
-
Save heffcodex/6d9979982d855dca685d86946d37cbd3 to your computer and use it in GitHub Desktop.
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
func EscapeMarkdownV2(text string) string { | |
escapeChars := "_*[]()~`>#+-=|{}.!" | |
return regexp.MustCompile(fmt.Sprintf("([%s])", regexp.QuoteMeta(escapeChars))).ReplaceAllString(text, "\\$1") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment