Re: Substitutions in matched patterns?



>> what is the easiest way to do substitutions in matched strings.
>> For example I want to do s/ABC/DEF/g , but only if the ABC is between
>> braces.
> s/{ABC}/{DEF}/g;

ABC is not directly between braces. It's more something like

s/({.*)ABC(.*})/\1DEF\2/g

but as it get's more complicating (more different substitutions), one needs
another solution.

Anton

.



Relevant Pages

  • Re: Substitutions in matched patterns?
    ... >>> what is the easiest way to do substitutions in matched strings. ... > ABC is not directly between braces. ...
    (comp.lang.perl.misc)
  • Re: Substitutions in matched patterns?
    ... >>> what is the easiest way to do substitutions in matched strings. ... > ABC is not directly between braces. ... captured strings you want to ...
    (comp.lang.perl.misc)
  • Re: expr command and substitutions
    ... about the expr command and substitutions. ... tutorial says to always put the values being evaluated inside braces ... substitutions seem to work in this manner. ... How is it that the variable substitution happens inside the ...
    (comp.lang.tcl)
  • expr command and substitutions
    ... about the expr command and substitutions. ... tutorial says to always put the values being evaluated inside braces ... substitutions seem to work in this manner. ... How is it that the variable substitution happens inside the ...
    (comp.lang.tcl)
  • Re: Possible Tcl enhancements
    ... does one round of substitutions (one layer of braces). ...
    (comp.lang.tcl)