Re: Routine for parsing path-filename....
Re: Routine for parsing path-filename....
- Subject: Re: Routine for parsing path-filename....
- From: Emmanuel <email@hidden>
- Date: Sat, 27 May 2006 13:05:58 +0200
At 11:18 AM +0200 5/27/06, Stefan Eriksson wrote:
Hello !
Trying to get a routine to parse a path like this, i have the path
and i have the filename and i want the result to
set thePath to "PB G4 Ster:Users:ster:Documents:Project:Aktuella
projekt:Breweries:East Europe:Baltic:100-150 Zelta Gold.pdf"
set the_file to "100-150 Zelta Gold.pdf"
gives
set pathresult to "PB G4 Ster:Users:ster:Documents:Project:Aktuella
projekt:Breweries:East Europe:Baltic:"
If you have more text processing to do maybe you could learn about
Regular expressions, as it's the killer way for that kind of thing,
look:
set pathresult to change ":[^:]+$" into ":" in thePath with regexp
That means: search for colon ( : ), followed by at least one, maybe
more ('+'), characters which may be whatever except colon ([^:]),
followed by the end of the string ($), and replace with the colon
only.
"change ... with regexp" is a command from Satimage.osax, a free osax
by us Satimage-software.
Our pages about Regular expressions are at:
<http://www.satimage.fr/software/en/reg_exp.html>
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden