[ALUG] regex, kate, gedit
Chris G
cl at isbd.net
Tue Dec 4 09:45:31 GMT 2007
On Tue, Dec 04, 2007 at 08:46:12AM +0000, Peter Alcibiades wrote:
> Hi, probably a silly question with an utterly obvious answer, but it would be
> great if someone can enlighten on it!
>
> I'm searching and replacing a text file. In gedit, if I search for \n\r I
> get, as expected, a match at every line end. Same with \n or \r.
>
> However, in Kate or Geany, I do not. Tearing hair out. What could be the
> problem? I've tried
>
> \n
> [\n]
>
> I've tried building up the expression in the K regex builder. I've tried
> selecting the line feed character and doing copy and paste. In Gedit it
> yields \n\r. In Geany it yields a couple of small square boxes with dots in
> them, which I then can't search on.
>
It's probably because Kate and Geany don't treat the whole file as a
single stream of characters, they regard each line as a separate
entity with separators between and so don't allow you to search for
'end of line'. They *might* have a special character for end-of-line,
the standard to use in REs is $ but in proper REs that's a virtual
character that exists between the \n (and \r if it's there) and the
next line, you can't search for $ (where it means end-of-line) you can
only use it as an RE delimiter really.
> Changing the coding doesn't seem to help either. At least, the ones I have
> tried. Is this likely to be the explanation? It displays fine however, so
> how do I find out which different coding to use?
>
> I would just do it in Gedit, except that as usual in the effort to make their
> apps unusable for anyone who wants to use them for anything, Gnome decline to
> support regex.....
>
I suspect that you'll need to use sed or awk or vi or emacs.
--
Chris Green
More information about the main
mailing list