[comp.sys.mac.programmer] MPW regexps

gae@osupyr.mast.ohio-state.edu (Gerald Edgar) (03/18/88)

I was trying to do some search-and-replace text editing using MPW
regular expressions.  Generally it works great.  But here is one thing
that I can do with Gnu Emacs, but I could not figure out with MPW.
Suppose I have this line of text:
   Qabcabc
I want to select everything from the character after the Q up to the
matching character:  Q<abca>bc.  I tried various combinations, but
without success.  Is this possible?  In these examples,  R  is the
option-R symbol, R-in-a-circle, and  X  is the option-X symbol, wavy lines.

replace /Q([a-z])R1XR1/ 'Q'
replace /Q([a-z])R1/:/R1/ 'Q'

Can these R constructions be used anywhere except in the second argument
of a replace?

A related question, perhaps of greater general interest:  is there
a regular expression that will match a string only if there are
matched parentheses in the string?
-- 
  Gerald A. Edgar                               TS1871@OHSTVMA.bitnet
  Department of Mathematics                     gae@osupyr.UUCP
  The Ohio State University  ...{akgua,gatech,ihnp4,ulysses}!cbosgd!osupyr!gae
  Columbus, OH 43210                            70715,1324  CompuServe