Re: Text parsing
Re: Text parsing
- Subject: Re: Text parsing
- From: Emmanuel <email@hidden>
- Date: Tue, 2 Mar 2004 10:24:47 +0100
At 1:27 AM -0600 02/03/04, Bill Monk wrote:
>
Interesting lines have these "fields"
>
>
[variable # of garbage chars]
>
[variable # of spaces]
>
[semaphore word enclosed in brackets]
>
[variable # of spaces]
>
[one or two digits]
>
[a period]
>
[variable # spaces]
>
[variable # of words of interesting text, call it A]
>
[variable # spaces]
>
[optional open parenthesis]
>
[if open paren is present, variable # of words of interesting text, call
>
it B]
>
[optional close paren]
>
>
>
Suggestions?
>
>
For each interesting line, I want to put interesting text "A" into an
>
item in a list, and interesting text "B" into a corresponding item in a
>
second list (or empty string if no text "B").
You've practically written the regular expression pattern yourself.
I won't test that now, sorry, but I think that the "find text" command in the Satimage osax will do the job for you. Something by:
find text (sema & beforeA & textA & beforeB & textB) with regexp, string result and all occurrences using {"\\1","\\3"}
sema would be "\\[semaphore_word\\]"
beforeA would be " *[0-9]{1,2}\\. *"
textA would be "(.*)"
beforeB would be " *"
textB would be "(($)|\\((.*)\\)$)"
Since the regular expression is so complicated, I would recommend testing everything from the "Find" (or "Enhanced Find") panel of Smile, since it uses "find text" itself.
The Satimage osax and Smile are free software for AppleScript, to be found at:
<
http://www.satimage-software.com>
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.