On 2020-06-19 12:44, Gary Dale wrote:
I love KATE and use it a lot. Unfortunately it seems to have a weird
setting somewhere (associated with either a file or session) that
affects regex search and replace.
I have been editing multiple files recently using regex's. Usually
KATE allows \n to match the end-of-line which lets me continue the
pattern on a second line. I'm editing a file right now where KATE
doesn't do that. For some reason it's keeping me on one line.
I've opened another (previously saved) session and tried it there and
KATE recognizes the \n properly so it's not the version of KATE that's
at fault. I've tried switching the End-Of-Line mode between Unix and
MS-DOS (and back) but that didn't help. I can't find any setting that
deals with the issue.
It's also not the particular document source AFAICT because a couple
days ago, I took a 2-year-old .sla (Scribus) file, removed all but one
page that I wanted to use as a template then saved that page, opened
it in KATE and removed all the "Copy of" styles that had accumulated
in it.
I did the same thing today (but saved a different page) but I can't
get the regex to match beyond a single line. When I add a \n at the
end of the regex, it finds 0 matches (if I instead add a $, it reports
the same number of matches as the initial regex, so my regex is
finding to the end of the line).
Any ideas on what's going wrong?
It gets weirder. I copied and pasted the text into a new document in a
KATE session where regex is matching \n in other files but the problem
persisted.
I did have some single-line "Copy of" styles that I was able to remove
but that left a blank line (because I can't match \n). Switching to
Escape Sequences, I was able to remove the blank lines by finding \n\n
and replacing it with \n. This suggests that KATE isn't encountering any
weird EOL characters. Replacing \n with \n also didn't affect the regex
find, even though it found and replaced every EOL character.