Re: Substitutions in matched patterns?
- From: "it_says_BALLS_on_your forehead" <simon.chao@xxxxxxx>
- Date: 31 Jan 2006 06:57:57 -0800
Anton81 wrote:
> >> 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.
what's wrong with:
s/({.*?)ABC(.*?})/$1DEF$2/g;
.
- References:
- Substitutions in matched patterns?
- From: Anton81
- Re: Substitutions in matched patterns?
- From: Bernard El-Hagin
- Re: Substitutions in matched patterns?
- From: Anton81
- Substitutions in matched patterns?
- Prev by Date: Re: Perl 6.x , please offer PREPEND as well as APPEND
- Next by Date: Re: split the sequences
- Previous by thread: Re: Substitutions in matched patterns?
- Next by thread: Re: Substitutions in matched patterns?
- Index(es):
Relevant Pages
|