[Geany-Devel] Regex in 1.25 and 1.26

Colomban Wendling lists.ban at xxxxx
Mon Dec 21 18:44:45 UTC 2015


Le 21/12/2015 18:31, Mark Robinson a écrit :
> Hi Guys,
> 
> Is the regular expression capability broken in 1.25 and 1.26
> 
> In 1.24, if I pop up the Find dialogue on a simple text file, I can
> search for \n with reg. expressions ticked and I find the end of the
> line.
> 
> If I do this in 1.25 or 1.26, it does not find the end of the line
> and claims it cannot find \n.
> 
> I notice single line reg. exp. was added at 1.25.

Which is the reason of your problem :)  Single-line regular expressions
can't find the \n because it's not part of the line itself, and in a
line-based regular expression the line end is $ (as it's the end of the
input).

So yes, 1.25 changed behavior by implementing single-line regular
expressions and making it the default (because I believed it was more
commonly what people were after, esp. because there's a history of
people confused by some multi-line results).

This doesn't mean you can't search for \n: you can either switch back to
multi-line regular expressions (there's a checkbox just for that), or if
you want to search for line ends (e.g. if line ends are not \n in your
file(s)), use $ with single-line regexes.

Regards,
Colomban


More information about the Devel mailing list