Re: Parsing Strings
Re: Parsing Strings
- Subject: Re: Parsing Strings
- From: Emmanuel <email@hidden>
- Date: Tue, 18 Dec 2007 00:05:12 +0100
At 4:33 PM -0500 12/17/07, Justin Laden wrote:
What is the best way to parse strings in AppleScript? I'm hoping to
parse strings in a list and pull out the first 5 letters or numbers,
but only if they lead with a letter and contain 4 following numbers.
Can anyone provide some ideas on parsing strings? Thanks!
A solution may be to install Satimage.osax (available for free at
http://www.satimage-software.com), and use its "find text" command
with a regular expression.
find text "^[a-zA-Z][0-9]{4}" in s with regexp
will return a match for a string beginning with (^) one letter
([a-zA-Z]) followed by four ({4}) digits ([0-9]) - and it will error
otherwise, so you include it in a try wrapper:
try
find text blah
-- found
on error
-- not found
end
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden