Search the web
Sign In
New User? Sign Up
gobo-eiffel · Gobo Eiffel
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Not terminating loop possible with RX_PCRE_REGULAR_EXPRESSION.replac   Message List  
Reply | Forward Message #1745 of 1767 |
Re: [gobo-eiffel] Not terminating loop possible with RX_PCRE_REGULAR_EXPRESSION.replace_all

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



Tue Jun 16, 2009 9:21 pm

gobosoft
Offline Offline
Send Email Send Email

Forward
Message #1745 of 1767 |
Expand Messages Author Sort by Date

Hi All, I've encountered a regular expression that causes a loop not to terminate. It happens when you want to insert something at the ... class TEST create ...
Berend de Boer
berenddeboer
Online Now Send Email
Jun 8, 2009
5:10 pm

... 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...
Berend de Boer
berenddeboer
Online Now Send Email
Jun 9, 2009
1:37 pm

... 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...
Eric Bezault
gobosoft
Offline Send Email
Jun 16, 2009
9:22 pm

... Eric> I now fixed it in the SVN repository in such a way that it Eric> works as well when there is no ^ at the beginning of the Eric> regexp. In that case...
Berend de Boer
berenddeboer
Online Now Send Email
Jun 17, 2009
10:00 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help