Notepad++ Perl 正規表示式中的替代字串

Notepad++ Perl 正規表示式中的替代字串

我正在嘗試在 perl 中實作一些舊的 notepad++ 正規表示式搜尋。

我使用以下命令。

perl -i -pe 'BEGIN{undef $/;} s/\\cellx10464\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f4\\fs20\\b\\cf0 Patent Information\\b0(?:.*[\r\n]+){88}\\cellx10464\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f1\\fs20\\cf0 \\f1\\fs20\\cf0 US \d{11}(?:.*[\r\n]+){52}\\cellx10464\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f1\\fs20\\cf0 \\f1\\fs20\\cf0 (US [0-9]{5,7})[\r\n]+\\cell\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f1\\fs20\\cf0 \\f1\\fs20\\cf0 (\w\d)[\r\n]+\\cell\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f1\\fs20\\cf0 [a-zA-Z]{3} [0-9,]{3} [0-9]{4}[\r\n]+\\cell\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f1\\fs20\\cf0 \\f1\\fs20\\cf0  [\r\n]+\\cell\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\plain/tttttt$1 $2/smg' 1.rtf

編輯 但它給出了錯誤。

在 -e 第 1 行 EOF 之前的任何地方都找不到字串終止符「'」。

這是我第一次接觸perl。我缺少什麼(或添加)什麼?

在 Windows 上使用草莓 Perl。

答案1

為造成的麻煩表示歉意。這已經有答案了https://stackoverflow.com/questions/20712181/strawberry-perl-regex-windows-7

在 Windows 中使用 " 代替 '。

相關內容