in reply to How to replace a piece of text containing brackets in an external file
Either you write $find='...\[...\]' or you use \Q for quoting s/\Q$find/.../.
DB<114> $_='abc[de]' => "abc[de]" DB<115> $find='c[de]' => "c[de]" DB<116> $find2='c\[de\]' => "c\\[de\\]" DB<117> m/$find/ # no match DB<118> m/$find2/ # match => 1 DB<119> m/\Q$find/ # match => 1 DB<120> "\Q$find" # how \Q=quotemeta works => "c\\[de\\]"
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to replace a piece of text containing brackets in an external file
by cre8tor (Initiate) on Dec 16, 2012 at 07:22 UTC |