Re: How to use "do shell script" to search for RegExps
Re: How to use "do shell script" to search for RegExps
- Subject: Re: How to use "do shell script" to search for RegExps
- From: "Rebecca O'Connell" <email@hidden>
- Date: Fri, 23 Apr 2004 11:54:34 -0400
Emmanuel:
If I were actually doing a search that simple I would use that technique.
But that was just a simplified example. My real searches look more like
this:
Find:([A-z,',-]+),[\t, ]*(([A-z,\.,',-]+[\t, ]+)+)[^\<]*\<
Replace:\2\t\1\t<
And up until 2 minutes ago, I didn't realize that you could use find text to
do a substring find and replace (i.e. set myVar to matchResult of (find text
"([A-z]*), ([A-z]*)" in "Last, First" using "\\2 \\1" with regexp) to get
"First Last"), so I wanted to be able to do that. And, I wanted to be able
to use certain grep features available in BBEdit (which may or may not be
available in Perl, but it was worth a shot) like \s for whitespace. (By the
way, if someone were to produce a sheet that detail which regexp expressions
are in use and maybe had a few examples, and were to post it, say, on the
Satimage website, that would be really helpful. Just a thought.)
Rebecca
On 4/22/04 4:13 AM, "Emmanuel" <email@hidden> wrote:
>
At 4:56 PM -0400 21/04/04, Rebecca O'Connell wrote:
>
> I have read a number of thread where someone suggests using "do shell
>
> script" and perl to do a string search. Could someone post an example of the
>
> syntax one would use to do this? For example if wanted to do something
>
> equivalent to
>
>
>
> if myVar contains \(a|A)\ then set hasA to true
>
>
>
> using a shell script how would I go about it?
>
>
Not a reply to your question, but why not using AppleScript? It's more
>
user-friendly, and the parameter passing mechanism is far more sophisticated
>
and powerful than for shell scripts, isnt'it.
>
>
Using the Satimage osax:
>
>
--------------------------
>
set hasA to false
>
try
>
find text "a" in myVar without case sensitive
>
set hasA to true
>
end try
>
--------------------------
>
>
And, in case you're wondering, Satimage's 'find text' is as fast as, e.g., the
>
'grep' shell command.
>
>
Satimage.osax is free:
>
<http://www.satimage-software.com/en/downloads_osaxen.html>
>
>
Emmanuel
>
_______________________________________________
>
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.
_______________________________________________
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.