MACSCRPT Archives

July 2007

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Joe Barwell <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Sat, 28 Jul 2007 23:12:48 +1300
Content-Type:
text/plain
Parts/Attachments:
text/plain (38 lines)
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.

ATOM RSS1 RSS2