Re: Find/replace
Re: Find/replace
- Subject: Re: Find/replace
- From: Christopher Stone <email@hidden>
- Date: Wed, 19 Aug 2009 06:03:47 -0500
Hey Bob,On Aug 18, 2009, at 17:52, Robert Poland wrote: I am trying to do a script that will strip the leading 5 characters from file names. For example I want "0050_2010_winners_accessories" to become "2010_winners_accessories".
Applescript only (simplest and lightning quick):
set x to "1234567890" text 6 thru -1 of x
Satimage Osax (very quick and versatile - my preferred means of find/replace):
-- All characters after the fifth one: set x to "0050_2010_winners_accessories"
set findData to x set findString to ".{5}(.+)" set returnString to "\\1"
set theResult to ¬ find text findString ¬ in findData ¬ case sensitive false ¬ regexp true ¬ using returnString ¬ with string result
-- Using the first underscore as an anchor:
set x to "0050_2010_winners_accessories"
set findData to x set findString to "_(.+)" set returnString to "\\1"
set theResult to ¬ find text findString ¬ in findData ¬ case sensitive false ¬ regexp true ¬ using returnString ¬ with string result
Chris |
_______________________________________________
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
References: | |
| >Find/replace (From: Robert Poland <email@hidden>) |