Re: can this be simplified?
Re: can this be simplified?
- Subject: Re: can this be simplified?
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 2 Aug 2010 14:22:00 -0400
Yes. First, I don't think you really want an inclusive list like the
TID's in your code. I think you want to replace everything that's not
from a small set of characters, probably just letters and numbers.
For ASCII-only names, this will work:
set jobBagName to (do shell script "sed -e
's/[^a-zA-Z0-9][^a-zA-Z0-9]*/_/g' <<<" & quoted form of jobBagName)
But to allow more general ideas of what constitutes a "letter", sed
won't cut it. You can use Perl:
set jobBagName to (do shell script "perl -Mencoding=utf8 -lpe
's/\\P{Alnum}+/_/g' <<<" & quoted form of jobBagName)
--
Mark J. Reed <email@hidden>
_______________________________________________
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