• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to crash a RegEx droplet... - SOLVED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Creator types as Class and I can't coerce it back
  • Next by Date: Re: Photoscripting IPTC captions.
  • Previous by thread: Intellimouse update
  • Next by thread: iSearch Auto-retrieve
  • Index(es):
    • Date
    • Thread