Re: How to crash a RegEx droplet... - SOLVED
Re: How to crash a RegEx droplet... - SOLVED
- Subject: Re: How to crash a RegEx droplet... - SOLVED
- From: Hans Haesler <email@hidden>
- Date: Sat, 12 May 2001 09:23:09 +0200
Solved, but not explained...
This morning I've got a private message which didn't gave me the
answer, but made me investigate some more.
The solution: remove the parentheses!
Change ...
---
set aSt to (REReplace aSt pattern "( )+( )" with " ")
---
... to ...
---
set aSt to (REReplace aSt pattern " +" with " ")
---
This works for replacing two or more spaces with one space.
And there is no crash when there are more than 128 spaces in a row.
Since I'm using backreferences a lot, I used the grouping parentheses,
too, thinking that they help to better "see" the two spaces, when
reading the script. And it worked fine for more than one year, if
I count the first versions. It's only the day before yesterday, after
thousands of runs, that the 129-character limit has been overstepped.
In the first example, the space(s) are groups. There must be a reason
why this form is limited to 128, while the single characters of the
second example may match hundreds of spaces with no problem at all.
Hans
---
Hans Haesler | email@hidden