Re: Creating a new folder (Was: [OT])
Re: Creating a new folder (Was: [OT])
- Subject: Re: Creating a new folder (Was: [OT])
- From: Christopher Nebel <email@hidden>
- Date: Mon, 10 May 2004 09:48:29 -0700
On May 10, 2004, at 12:17 AM, Joseph Weaks wrote:
set aPattern to "\\<id[A-Za-z][A-Za-z]\\>" -- *see note below
set bPattern to "\\<mar[A-Za-z]"
set aScript to "grep " & quoted form of aPattern & "
/usr/share/dict/words"
set bScript to "grep " & quoted form of bPattern & "
/usr/share/dict/words"
set aList to words of (do shell script aScript)
set bList to words of (do shell script bScript)
set theText to "Beware the " & (some item in aList) & " of " & (some
item in bList)
return theText
* I wanted the pattern to find any word of 4 to 7 letters in length
beginning with "id" and ending in "s", but "\\<id[A-Za-z]{1,4}s" cause
a type one error. Dunno why.
Because {} qualifiers are not part of standard grep syntax, only
extended grep. grep(1) is being unhelpful and not telling you that.
Use "egrep" or "grep -E" instead, though realize that without a
trailing "$" or "\>", you'll actually get "id" followed by 1 to 4
letters, followed by "s", *followed by anything else*, so you'll get
results like "idiosyncratic". However, any of these work (as shell,
not AppleScript):
egrep '\<id[A-Za-z]{1,4}s\>'
grep -E '^id[A-Za-z]{1,4}s$'
egrep -i '^id[a-z]{1,4}s$'
--> ides, idolous
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.