mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Check that a string contains markdown symbols instead of matches (#2080)
.* does not match line breaks, so this regex would never apply to multiline text. This checks for contains instead of using .* to account for this. Fixes #2049
This commit is contained in:
parent
5a27d7cd98
commit
138506211a
1 changed files with 2 additions and 2 deletions
|
|
@ -204,12 +204,12 @@ object MarkdownParser {
|
|||
return EmojiParser.convertToCheatCode(input.toString())
|
||||
}
|
||||
|
||||
private val markdownRegex = ".*[*#_\\[`~].*".toRegex()
|
||||
private val markdownRegex = "[*#_\\[`~]".toRegex()
|
||||
private val imageMarkdownRegex = """!\[.*?]\(.*?".*?"\)""".toRegex()
|
||||
private val markdownLinkRegex = "\\[([^\\]]+)\\]\\(([^\\)]+)\\)".toRegex()
|
||||
|
||||
fun containsMarkdown(text: String): Boolean {
|
||||
return text.matches(markdownRegex) ||
|
||||
return text.contains(markdownRegex) ||
|
||||
text.contains(imageMarkdownRegex) ||
|
||||
text.contains(markdownLinkRegex)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue