Using any stream editor, (or vim), is there a fast, efficient yet simple way to do a substitution but only inside an already matched pattern. for example :
Replace all parameter "foo" with "bar" but only for the function "func" :
test(foo, baz) func(foo) truc(foo) func(test, foo)
->
test(foo, baz) func(bar) truc(foo) func(test, bar)
would be done by first searching : /func\((.*)\)/
...And then, inside the captured group (or at least the full match), do s/foo/bar/g
NOTE : I've read using sed to replace two patterns within a larger pattern
But I'm looking for a simpler way, not necessarily using sed