[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Programming: best ci strategy



I'm doing a lot of changes of items that are delimited by either a carriage
return+linefeed or by spaces. E.g., I want to find the word "print" (no
quotes) when preceded by [crlf] or by a space. I can't use the separator
wildcard [S] because I don't want the ci /// to act on, for instance, the
term "file.print." and it would, because the period is a separator.
Suppose I want to change a line with a print statement in it to have what
follows it surrounded by quote marks: e.g.,

print hello first.name$ ==> print "hello first.name$"

I use:

ci /[crlf]print [W][crlf]/[crlf]print "[W]"[crlf]/
(That's dicey, because some lines are longer than the 80 character-limit of [W], and doubling both [W]s to [W][W] gives the error "wildcards must be in the same order.")
But my real problem is that some lines I want to change have a "print" in
the middle, as below:
if last.name$ = "Bins" then last.name$ = "Binswanger" : print hello
first.name$ : stop
In such cases, the print part is always introduced by a " : " as above, so
I have that to use as a delimiter if I want to make up a second ci. But
there are so many cases, and I hate to try to cover them all in separate
ci's, especially when the order of changes becomes relevant.

I tried using the OR wildcard [O], with mixed results. E.g.,

[crlf]print [0] : print

but using that with [W] quickly runs into several problems.
So is there some smart way of doing changes for items delimited by more than one set of symbols?


Harry Binswanger
hb@xxxxxxxx