george fotheringay wrote:
Nevermind, I think I figured it out: "\" must be a Lua escape too, so
that you need to write "^\\[" in order for Lua to generate the string
"^\[" to feed the SciTE search. (This is slightly diabolical :-))

Yes, that's the usual problem with regexes in programming languages, except when they have a special notation like in Perl or JavaScript (/^\[/ for example).
There is a simple workaround for Lua, offering a better visibility:

  editor:findtext([[^\[]],SCIFIND_REGEXP,position)

OK, given that you search a bracket, that's not so much readable, but literal strings are usually better for strings with backslashes in them.

Note that Lua's internal regexes uses % as escape char, so we don't have backslash hell (try matching a Windows path...)

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to