From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 11 Jan 2013 12:44:21 +0100 Message-ID: From: Rudolf Sykora To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] How to do this with [acme | sam | sed ] ? Topicbox-Message-UUID: 05bcb930-ead8-11e9-9d60-3106f5b1d025 On 11 January 2013 12:19, Peter A. Cejchan wrote: > # remove outermost pair of braces: abcd(x+(y-z))efgh --> abcdx+(y-z)efgh This, I believe, can't be achieved only with regexps. I'd write a small external program and use it as a filter. > # prefix to postfix operator: ++i --> i++ > [ Edit s/\+\+[a-zA-Z]+[0-9a-zA-Z]*/&++/ Edit s/\+\+/d] using the \1 (used to be undocumented on plan9) may be sometimes easier Edit s/\+\+([A-Za-z]+[A-Za-z0-9])*/\1++/ Ruda