diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-05-04 15:02:19 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-05-04 21:57:37 +1000 |
commit | a942eef12415e0b53e04279259dd92cca4d444f0 (patch) | |
tree | 34edc849d5b2b528d3986e3782bbb44261f6b75f /tests/regexp.test | |
parent | ac35b8a6ec417f75b5ec86ca64ea1614a8170a38 (diff) | |
download | jimtcl-a942eef12415e0b53e04279259dd92cca4d444f0.zip jimtcl-a942eef12415e0b53e04279259dd92cca4d444f0.tar.gz jimtcl-a942eef12415e0b53e04279259dd92cca4d444f0.tar.bz2 |
regsub: Fix regsub -all with \A
regsub -all matches \A against the start of each match, but
correctly handle a pattern like ^ which does not advance the
match
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/regexp.test')
-rw-r--r-- | tests/regexp.test | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/regexp.test b/tests/regexp.test index c6133e7..45eddbb 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -489,11 +489,11 @@ test regexp-16.3 {regsub -start} { catch {unset x} list [regsub -all -start 3 {z} hello {/&} x] $x } {0 hello} -#test regexp-16.4 {regsub -start, \A behavior} { -# set out {} -# lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x -# lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x -#} {5 /a/b/c/d/e 3 ab/c/d/e} +test regexp-16.4 {regsub -start, \A behavior} { + set out {} + lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x + lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x +} {5 /a/b/c/d/e 3 ab/c/d/e} test regexp-16.5 {regsub -start, double option} { list [regsub -start 2 -start 0 a abc c x] $x } {1 cbc} |