From: nanothermite911fbibustards on 22 Jun 2010 21:06 Very EDUCATIONAL VIDEO http://www.youtube.com/watch?v=wzr_hRsSuGM&feature=related On Jun 22, 1:40 pm, Cecil Westerhof <Ce...(a)decebal.nl> wrote: > Op dinsdag 22 jun 2010 19:28 CEST schreef Pascal J. Bourguignon: > > > > >>> this (while (re-search-forward ...)) loop modifies the line for each > >>> occurence of the regexp, replacing it with (substring substitute-str 0 > >>> match-length), which is a different replacement string in general. > > >> Why? I would think the replacement string is the same. (When using > >> single byte characters.) > > > With: > > > substitute-str = "Abcdef" ; initally > > start-match = 4 > > end-match = 12 > > match-length = 8 > > > substitute-str will become "AbcdefAbcdef", > > and (substring substitute-str 0 match-length) = "AbcdefAb" > > while (substring substitute-str start-match end-match) = "efAbcdef" > > I made a stupid mistake. It did not show because I only changed a > substring at the start of the line. Better code is at: > http://www.decebal.nl/guile/sources/substituteExpression.scm > > -- > Cecil Westerhof > Senior Software Engineer > LinkedIn:http://www.linkedin.com/in/cecilwesterhof |