Re: Regex in OS X
Re: Regex in OS X
- Subject: Re: Regex in OS X
- From: BJ Terry <email@hidden>
- Date: Fri, 6 Feb 2004 14:04:48 -0800
It seems that in principle the only thing you need to do is construct
an extremely simple regex string, then use one of the many utilities to
use it. The regex string would simply be: "^" and the string you're
searching for and ".*". This would then be directly useable in either
Satimage's osax as
find text "^Macdonalds.*" in "Macdonalds MacDonalds\ndog" with regexp
This matches the line "Macdonalds MacDonalds" as Satimage's osax
defaults to a "dot doesn't match newline" mode. One could also use this
in a do shell script:
do shell script "grep \"^Macdonalds\" /path/to/file"
returns every line of the file which begins with Macdonalds. The .* is
necessary in Satimage to capture the whole line, but grep defaults to
printing the whole line on a match, so it isn't necessary.
BJ
_______________________________________________
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.
References: | |
| >Regex in OS X (From: Hanaan Rosenthal <email@hidden>) |