Re: Regex on OS X
Re: Regex on OS X
- Subject: Re: Regex on OS X
- From: John Delacour <email@hidden>
- Date: Tue, 1 Oct 2002 21:13:07 +0100
At 2:08 pm -0500 1/10/02, ken wrote:
Does anyone know if there are any osaxen to to
regex searches on OS X? If not, what are my
options? Thanks.
Your best option is to use perl in a 'do shell script' command. This
is one of the great things about OS 10.
Here's a simple example to print all lines that contain 'Jan'
set s to "
1 Jan Smith
2 Jane Smith
3 Jan Jones
4 Jane King
5 Jan Long
6 Jan Mann
7 Janet Hale
8 Janine Winter
"
--
set JAN_HITS to do shell script "perl -e '
@_ = split /\\015/, qq(" & s & ");
for (@_){
/(\\d+\\s+)(Jan[^\\w].+)/ and print qq($2$/)
}'"
--
return JAN_HITS
If you really want to do it with an osax, then there is mgrep OSAX MacOS X
<
http://www.bekkoame.ne.jp/~iimori/indexSoftware.html>
but it makes more sense to use the perl regex syntax.
JD
_______________________________________________
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.