Test case for #297

This commit is contained in:
John Kerl 2021-08-11 22:44:57 -04:00
parent 9286f5a3b1
commit 55209bfc5c
6 changed files with 26 additions and 13 deletions

View file

@ -0,0 +1 @@
mlr --oxtab put -f ${CASEDIR}/mlr regtest/input/regex-metacharacters.dkvp

View file

@ -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

View file

@ -0,0 +1,5 @@
$left = gsub($input, "\[", "LEFT");
$all = gsub($input, ".", "ALL");
$dot = gsub($input, "\.", "DOT");
$star = gsub($input, "\*", "STAR");
$right = gsub($input, "\]", "RIGHT");

View file

@ -0,0 +1 @@
input=abc[.o*o.]def

View file

@ -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