> # remove outermost pair of braces:  abcd(x+(y-z))efgh  --> abcdx+(y-z)efgh
>          [ no idea :-( ]

this is made simple since * is "greedy":

Edit s:\((.*)\):\1:g

On Fri Jan 11 06:45:39 EST 2013, [email protected] wrote:
> On 11 January 2013 12:19, Peter A. Cejchan <[email protected]> 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++/

should be "Edit s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/"

ideally one should include _ and ¡-�.

- erik

Reply via email to