• 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: limiting numeric runs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: limiting numeric runs


  • Subject: Re: limiting numeric runs
  • From: Paul Skinner <email@hidden>
  • Date: Thu, 9 Jan 2003 15:43:54 -0500

On Thursday, January 9, 2003, at 05:25 AM, Emmanuel wrote:

At 12:47 PM -0500 08/01/03, Paul Skinner wrote:
I need to limit the length of numeric runs in a given text. Does anyone have a suggestion as to a non-looping solution?

I'm afraid that's a one-liner with a regular expression. If you can use the Satimage osax:

------------------ untested, sorry
on LimitNumericRuns(inputText, runLengthLimit)
change "([0-9]{4})[0-9]+" into "\\1" in inputText with regexp
end

AND

On Thursday, January 9, 2003, at 07:04 AM, has wrote:

Paul Skinner wrote:

I need to limit the length of numeric runs in a given text. Does anyone
have a suggestion as to a non-looping solution?

Using regular expressions, c/o Satimage OSAX:

change "([[:digit:]]{4})[[:digit:]]+" into "\\1" in str with regexp

has

Obviously RegEx is the hammer and AppleScript the heel of my boot when it comes to the right tool for this nail. Unfortunately this is for distribution, and everyone has a boot.

I am proud to say that my most recent handler 'LimitNumericRuns' requires only 10x the time of the RegEx posted by Has. No offense Emmanuel, but his didn't say 'untested' ; )
I'm sure that the RegEx could also be modified to allow numeric runs that precede a decimal to be left intact. but I don't know RegEx like I should.
Thank you all for your assistance!
--
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: limiting numeric runs (From: Emmanuel <email@hidden>)

  • Prev by Date: AS solutions for FileMaker "email tickler"
  • Next by Date: Re: Reading input from a delimited source file
  • Previous by thread: Re: limiting numeric runs
  • Next by thread: Re: limiting numeric runs
  • Index(es):
    • Date
    • Thread