Behaviour of regexp-replace-all

From: Sean Slattery <jslttery_at_GS148.SP.CS.CMU.EDU>
Date: Thu, 25 May 1995 12:48:08 -0400

The behaviour of regexp-replace-all seems a tad weird and definitely
counter-intuitive to me.

In tcl the behaviour is as follows:

% regsub -all "aa" "aaaa aaaa" "a" q
1
% set q
aa aa

The matcher does not use something it has already substituted as a match in
any future search.

However STk does the following:
STk> (regexp-replace-all "aa" "aaaa aaaa" "a")
"a a"

I presume it goes through the following steps:
"aaaa aaaa" -> "aaa aaaa" -> "aa aaaa" -> "a aaaa" .....

Is this the intended behaviour?

S.

PS I've just noticed that regexp-replace-all is written in scheme, so I may
try to write a version that works like the tcl one. Anyone else interested?
Received on Thu May 25 1995 - 18:49:45 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST