From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Fri, 11 Jan 2013 09:24:05 -0500 To: 9fans@9fans.net Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] How to do this with [acme | sam | sed ] ? Topicbox-Message-UUID: 05f7627e-ead8-11e9-9d60-3106f5b1d025 > # remove outermost pair of braces: abcd(x+(y-z))efgh --> abcdx+(y-z)e= fgh > [ no idea :-( ] this is made simple since * is "greedy": Edit s:\((.*)\):\1:g On Fri Jan 11 06:45:39 EST 2013, rudolf.sykora@gmail.com wrote: > On 11 January 2013 12:19, Peter A. Cejchan wrote: > > # remove outermost pair of braces: abcd(x+(y-z))efgh --> abcdx+(y-z= )efgh >=20 > This, I believe, can't be achieved only with regexps. I'd write a > small external program and use it as a filter. >=20 > > # prefix to postfix operator: ++i --> i++ > > [ Edit s/\+\+[a-zA-Z]+[0-9a-zA-Z]*/&++/ Edit s/\+\+/d] >=20 > using the \1 (used to be undocumented on plan9) may be sometimes easier > Edit s/\+\+([A-Za-z]+[A-Za-z0-9])*/\1++/ should be "Edit s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/" ideally one should include _ and =C2=A1-=EF=BF=BF. - erik