add regex unicode match support

This commit is contained in:
jiangxiaoming 2022-11-22 12:15:44 +08:00
parent a3bb271432
commit 4839a633e3
3 changed files with 175 additions and 3 deletions

View file

@ -376,6 +376,18 @@ module pattern{
}
}
}
leaf p48 {
description "Chinese characters in unicode format";
type string {
pattern '[\u4E00-\u9FA5]+';
}
}
leaf p49 {
description "Arabic characters in unicode format";
type string {
pattern '[\u0600-\u06FF]+';
}
}
}
}
EOF
@ -751,9 +763,18 @@ testrun "p$pnr" false '248:197.7.89/8'
let pnr=47 # '.*[\n].*
testrun "p$pnr" true 'Ensure all nights are cold'
testrun "p$pnr" false 'kalle foo'
testrun "p$pnr" false 'kalle
foo'
testrun "p$pnr" false '01234567890123456789012345678901234567890123456789012345678901234567890123456789zzz'
let pnr=48
testrun "p$pnr" true '你好'
testrun "p$pnr" false 'hello'
let pnr=49
testrun "p$pnr" true 'مرحبا'
testrun "p$pnr" false 'hello'
# CLI tests
new "CLI tests for RFC7950 Sec 9.4.7 ex 2 AB"
expectpart "$($clixon_cli -1f $cfg -l o set c rfc2 AB)" 0 '^$'