Berend de Boer wrote:
>>>>>> "Berend" == Berend de Boer <berend@...> writes:
>
> Berend> What happens is that the start position is 1, and the end
> Berend> position is 0. has_matched is always true. I'm not sure
> Berend> how to solve this. This was what I have now:
>
> My previous solution didn't work that well. Here another attempt:
>
> new_end, previous_end: INTEGER
> do
> old_subject_start := subject_start
> from until not has_matched loop
> STRING_.append_substring_to_string (a_string, subject, subject_start,
captured_start_position (0) - 1)
> append_replacement_to_string (a_string, a_replacement)
> previous_end := captured_end_position (0)
> match_substring (subject, previous_end + 1, subject_end)
> new_end := captured_end_position (0)
> if previous_end = new_end then
> -- Get out of loop, we're matching the same thing,
> -- i.e. we're not making any progress.
> match_count := 0
> end
> end
>
> So if the captured_end_position doesn't move, we quite the loop.
I now fixed it in the SVN repository in such a way that it works
as well when there is no ^ at the beginning of the regexp. In that
case it is assumed that there is only one matching empty string
between each character. Can you please give it a try and let me
know if it works for you?
--
Eric Bezault
mailto:ericb@...
http://www.gobosoft.com