in reply to Re^5: Regex find and replace involving new line
in thread Regex find and replace involving new line
It behaves notoriously sometimes.
I have string
perl -i.bak -pe "BEGIN{undef $/;} s/\\cellx10464\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f4\\fs20\\b\\cf0 Patent Information\\b0([^\r?\n]*[\r?\n]){88}.*(EP \d{5,7})(([^\r?\n]*[\r?\n]){52}).*$2[\r\n]+\\cell\\pard\\plain\\intbl\\s0\\ql\\fi0\\li0\\ri0\\sl320\\plain\\f1\\fs20\\cf0 \\f1\\fs20\\cf0 (B\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$2 $4/smg;" 1.rtfMy rtf contains
somestring(88 paragraphs mached as $1)(string $2)(52 paragraphs mached as string 3).*$2{means found string}[\r\n]+some string(string $4)somestringIt doesn't give the desired result. I thing it matches first occurrence of first found and last occurence of last found and removes all the lines between that are iportant one.
I am using windows strawberry perl. where am I making mistake?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Regex find and replace involving new line
by AnomalousMonk (Archbishop) on Dec 15, 2015 at 13:17 UTC | |
|
Re^7: Regex find and replace involving new line
by Corion (Patriarch) on Dec 15, 2015 at 09:21 UTC | |
by PRA007 (Initiate) on Dec 15, 2015 at 12:13 UTC |