You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
491 B
25 lines
491 B
extends WAT.Test
|
|
|
|
|
|
func test_regex():
|
|
var regex = RegEx.new()
|
|
# nope, no unicode
|
|
# regex.compile("[^a-zA-Z0-9+._-]+")
|
|
# compile: 12: unknown property name after \P or \p
|
|
# regex.compile("[^\\p{Letter}]") # T_T
|
|
# This works \o/
|
|
regex.compile("[^\\p{L}\\p{N}]")
|
|
|
|
var ea = [
|
|
["zozo04", "zozo04"],
|
|
["a b c d é", "abcdé"],
|
|
["仕方がない!", "仕方がない"],
|
|
]
|
|
|
|
for in_out in ea:
|
|
var actual = regex.sub(in_out[0], '', true)
|
|
asserts.is_equal(
|
|
in_out[1], actual
|
|
)
|
|
|