Simplify hashtag line checker to avoid infinite loop in android matcher (#4779)
https://masto.nyc/@GetMisch/113557332197065306 causes an infinite loop in the native matcher with the original pattern, trying a different approach
This commit is contained in:
parent
96ed6e14b0
commit
af5d10cd09
2 changed files with 3 additions and 6 deletions
|
|
@ -8,8 +8,6 @@ import kotlin.random.Random
|
|||
|
||||
private const val POSSIBLE_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
const val WORD_BREAK_EXPRESSION = """(^|$|[^\p{L}\p{N}_])"""
|
||||
const val WORD_BREAK_FROM_SPACE_EXPRESSION = """(^|$|\s)"""
|
||||
const val HASHTAG_EXPRESSION = "([\\w_]*[\\p{Alpha}_][\\w_]*)"
|
||||
val hashtagPattern = Pattern.compile(HASHTAG_EXPRESSION, Pattern.CASE_INSENSITIVE or Pattern.MULTILINE)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue