in reply to Re: Advanced replace function
in thread Advanced replace function
s/\[.*?\]/~~/sg
But that's risky, especially if you use it a larger pattern. The /.*?/ could match a "[" or a "]". That's obviously undesirable. The following pattern avoids that problem:
s/\[[^\[\]]*\]/~~/g;
|
|---|