Subject: | |
From: | |
Reply To: | |
Date: | Sat, 28 Jul 2007 23:12:48 +1300 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hello people,
I have a regex question, using the Satimage osax.
I am trying to ignore lines that end with the following:
\tAAA\t
but otherwise strip trailing tabs (NB '\t' is used above to signify a tab character in the string). The trouble is that the following:
set s to change "([^(AAA)])\\t$" into "\\1" in s with regexp
not only ignores the lines I wish, but it also ignores lines that end with (for example):
BBA\t
I think the problem is that inside [] is a list or characters, to which the
^ "not" function is being applied. How can I apply the "not" function not
just to (a list of) single characters, but to a group of three specific
successive characters?
I can "solve" the problem by using a single token that is unlikely to occur
in my data, but that seems less "safe" than the original three-character
token set:
set s to change "\\tAAA\\t$" into "\\t#\\t" in s with regexp
set s to change "([^#])\\t$" into "\\1" in s with regexp
set s to change "\\t#\\t$" into "\\tAAA\\t" in s with regexp
TIA for any suggestions.
Cheers!
Joe
Selected from Ambrose Bierce's "Devil's Dictionary":
REAR, n. -- In American military matters, that exposed part of the army that is nearest to Congress.
|
|
|