diff --git a/go/regtest/cases/dsl-regex-matching/0016/cmd b/go/regtest/cases/dsl-regex-matching/0016/cmd new file mode 100644 index 000000000..c90b15684 --- /dev/null +++ b/go/regtest/cases/dsl-regex-matching/0016/cmd @@ -0,0 +1 @@ +mlr --oxtab put -f ${CASEDIR}/mlr regtest/input/regex-metacharacters.dkvp diff --git a/go/regtest/cases/dsl-regex-matching/0016/experr b/go/regtest/cases/dsl-regex-matching/0016/experr new file mode 100644 index 000000000..e69de29bb diff --git a/go/regtest/cases/dsl-regex-matching/0016/expout b/go/regtest/cases/dsl-regex-matching/0016/expout new file mode 100644 index 000000000..b4b5081bf --- /dev/null +++ b/go/regtest/cases/dsl-regex-matching/0016/expout @@ -0,0 +1,6 @@ +input abc[.o*o.]def +left abcLEFT.o*o.]def +all ALLALLALLALLALLALLALLALLALLALLALLALLALL +dot abc[DOTo*oDOT]def +star abc[.oSTARo.]def +right abc[.o*o.RIGHTdef diff --git a/go/regtest/cases/dsl-regex-matching/0016/mlr b/go/regtest/cases/dsl-regex-matching/0016/mlr new file mode 100644 index 000000000..aadfeaae2 --- /dev/null +++ b/go/regtest/cases/dsl-regex-matching/0016/mlr @@ -0,0 +1,5 @@ +$left = gsub($input, "\[", "LEFT"); +$all = gsub($input, ".", "ALL"); +$dot = gsub($input, "\.", "DOT"); +$star = gsub($input, "\*", "STAR"); +$right = gsub($input, "\]", "RIGHT"); diff --git a/go/regtest/input/regex-metacharacters.dkvp b/go/regtest/input/regex-metacharacters.dkvp new file mode 100644 index 000000000..38d4efeba --- /dev/null +++ b/go/regtest/input/regex-metacharacters.dkvp @@ -0,0 +1 @@ +input=abc[.o*o.]def diff --git a/go/todo.txt b/go/todo.txt index 38dc2adea..156447617 100644 --- a/go/todo.txt +++ b/go/todo.txt @@ -29,26 +29,26 @@ w discussion re docs6 ... ---------------------------------------------------------------- REGEX CAPTURES -! to do: +* testing: - o testing: + echo 'x=[.o*o.]' | mlr put '$y=gsub($x, "\[", "LEFT")' + x=[.o*o.],y=LEFT.o*o.] - echo 'x=[.o*o.]' | mlr put '$y=gsub($x, "\[", "LEFT")' - x=[.o*o.],y=LEFT.o*o.] + echo 'x=[.o*o.]' | mlr put '$y=gsub($x, ".", "ALL")' + x=[.o*o.],y=ALLALLALLALLALLALLALL - echo 'x=[.o*o.]' | mlr put '$y=gsub($x, ".", "ALL")' - x=[.o*o.],y=ALLALLALLALLALLALLALL + echo 'x=[.o*o.]' | mlr put '$y=gsub($x, "\.", "DOT")' + x=[.o*o.],y=[DOTo*oDOT] - echo 'x=[.o*o.]' | mlr put '$y=gsub($x, "\.", "DOT")' - x=[.o*o.],y=[DOTo*oDOT] + echo 'x=[.o*o.]' | mlr put '$y=gsub($x, "\*", "STAR")' + x=[.o*o.],y=[.oSTARo.] - echo 'x=[.o*o.]' | mlr put '$y=gsub($x, "\*", "STAR")' - x=[.o*o.],y=[.oSTARo.] + echo 'x=[.o*o.]' | mlr put '$y=sub($x, "\]", "RIGHT")' + x=[.o*o.],y=[.o*o.RIGHT - echo 'x=[.o*o.]' | mlr put '$y=sub($x, "\]", "RIGHT")' - x=[.o*o.],y=[.o*o.RIGHT +* mlr put must not accept -x - o mlr put must not accept -x +* torbiak informs x 2 commits ---------------------------------------------------------------- DOC6