aboutsummaryrefslogtreecommitdiff
path: root/tests/regex/testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-08-30 10:23:06 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-08-30 20:57:48 +0300
commit0cf84e1f006988c114bdca36715d3a2c0601a7d5 (patch)
tree8f372d93ac2ed9bde3b57e1e4efe440b3d86d056 /tests/regex/testscript
parentc9a062d44807803f1cdfcfe62d49ad1f18162baa (diff)
Generalize regex_replace_ex() function
Diffstat (limited to 'tests/regex/testscript')
-rw-r--r--tests/regex/testscript54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/regex/testscript b/tests/regex/testscript
new file mode 100644
index 0000000..1af604c
--- /dev/null
+++ b/tests/regex/testscript
@@ -0,0 +1,54 @@
+# file : tests/regex/testscript
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+: match
+:
+{
+ $* abcbd b x >axcxd : all
+ $* -ffo abcbd b x >axcbd : first-only
+ $* -fnc abcbd b x >xx : no-copy
+
+ : ecma-escape
+ :
+ {
+ $* xay a '$b' >'x$by' : none
+ $* xay a '$' >'x$y' : none-term
+ $* xay a '$$' >'x$y' : self
+ $* xay a 'b$&c' >'xbacy' : match
+ $* xay a 'b$`c' >'xbxcy' : match-precede
+ $* xay a "b\\\$'c" >'xbycy' : match-follow
+
+ : capture
+ :
+ $* abcdefghij '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)' '$1$10' >aj
+ }
+
+ : perl-escape
+ :
+ {
+ $* xay a '\b' >'xby' : none
+ $* xay a '\' >'xy' : none-term
+ $* xay a '\\' >'x\y' : self
+
+ : capture
+ :
+ $* abcdefghij '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)' '\1\10' >aa0
+
+ : upper
+ :
+ {
+ $* xay a '\U' >xy : none
+ $* xay a '\Uvz' >xVZy : repl
+ $* xay a '\Uv\Ez' >xVzy : end
+ $* aa a 'v\Uz' >vZvZ : locality
+ $* xay '(a)' '\U\1' >xAy : capt
+ $* x-y '(a?)-' '\U\1z' >xZy : capt-empty
+ $* xay a '\uvz' >xVzy : once
+ }
+
+ : lower
+ :
+ $* xay a '\lVZ' >xvZy
+ }
+}