Opened 13 years ago

Last modified 11 years ago

#686 closed defect

irregex-replace/all doesn't grok `bos' — at Version 5

Reported by: Moritz Heidkamp Owned by: sjamaan
Priority: major Milestone:
Component: core libraries Version: 4.7.x
Keywords: irregex Cc: Alex Shinn
Estimated difficulty:

Description (last modified by Moritz Heidkamp)

When irregex-replace/all is given a pattern containing a bos anchor it will not behave as expected. For example this call:

  (irregex-replace/all '(seq bos #\space) "   x   " "*")

returns "***x " rather than the expected "* x ".

Change History (5)

comment:1 Changed 13 years ago by sjamaan

Cc: foof added

The problem is that it uses irregex-fold which walks the string; it starts at the given starting point, matches and then starts again with the new starting point in the string being the place where the previous match ended.

The problem is basically that the beginning of string should only match when the substring starts at wherever you initially started to match. I'm not sure if/how this can be solved easily.

comment:2 Changed 13 years ago by sjamaan

Cc: Alex Shinn added; foof removed

comment:3 Changed 12 years ago by felix winkelmann

Milestone: 4.8.0

comment:4 Changed 12 years ago by sjamaan

I can't reproduce this (anymore?), not even with a clean 4.7.0; what happened?!

comment:5 Changed 12 years ago by Moritz Heidkamp

Description: modified (diff)
Note: See TracTickets for help on using tickets.