Refactor: invert whitespace stripping pattern
This commit is contained in:
parent
00ec796c7a
commit
b1061f0165
1 changed files with 1 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ enum Kind { PLAYER, SYSTEM }
|
||||||
static func sanitize_body(value: Variant) -> String:
|
static func sanitize_body(value: Variant) -> String:
|
||||||
if typeof(value) != TYPE_STRING:
|
if typeof(value) != TYPE_STRING:
|
||||||
return ""
|
return ""
|
||||||
var strippable_whitespace = RegEx.create_from_string("^[\\s\\p{Z}\\p{Cf}\\x{2800}]+|[\\s\\p{Z}\\p{Cf}\\x{2800}]+$")
|
var strippable_whitespace = RegEx.create_from_string("^[^\\w]+|[^\\w]+$")
|
||||||
var result := strippable_whitespace.sub(value, "")
|
var result := strippable_whitespace.sub(value, "")
|
||||||
if result.is_empty() or result.length() > MAX_VISIBLE_CHARACTERS:
|
if result.is_empty() or result.length() > MAX_VISIBLE_CHARACTERS:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue