Multi-line Search and Replace
28 Feb 2006
I’ve seen a number of comments spotted around blogs claiming that PN2 doesn’t support multi-line search and replace. This isn’t true.
For example, if you take the following text:
`
`
You can change this to `` by searching for ">\r\n< " and replacing with ">< ". For this to work, you must have the Allow Backslash Expressions checkbox checked. This checkbox enables the following:
\n - Line Feed Character (#10)
\r - Carriage Return (#13)
\t - Tab (#9)
So, PN does support search and replace across multiple lines. The only thing that it doesn't support is regular expressions across line boundaries - yet!
I wonder if the reason people give up is the \r\n thing instead of \n? This is because windows format files have two characters to match there. I wonder if some editors make \n match the equivalent of `\r?\n.
**Note**: I had to re-type this entry three times before giving up on WordPress' rich text editor - I couldn't type those XML nodes in using either the rich editor or the plain text editor without them being stripped.