On Sat, Jan 02, 2021 at 06:45:21PM +0100, Kornel Benko wrote:
> Am Sat, 2 Jan 2021 09:23:00 -0500
> schrieb Scott Kostyshak <skost...@lyx.org>:
> 
> > On Sat, Jan 02, 2021 at 12:47:13PM +0100, Kornel Benko wrote:
> > > Given the string
> > >   t = "\foreignlanguage{russian}{\texttt{\label}"
> > > and trying to use
> > >   "regex_replace(t, t,
> > >   
> > > "\\\\(emph|noun|text(bf|sl|sf|it|tt)|(u|uu)line|(s|x)out|uwave)(\\{(\\{\\})?\\})+",
> > >   "")
> > > leads to regex-exception.
> > > Anything other than "\label" works. (e.g. "\xyzzy" or "\lxabel", or 
> > > "\labelx")
> > > 
> > > Does anyone know, what's going on here?
> > > (It does not even depend on "\texttt", because already
> > >   t = "\foreignlanguage{russian}{\label"
> > > leads to the exception.  
> > 
> > Does the exception give any message? Does it give more information if
> > you catch the exception and print the message, like the following?
> > 
> >   https://en.cppreference.com/w/cpp/regex/regex_error
> > 
> > Scott
> 
> In the meantime I make a small example. Compiled, and to my surprize, it went 
> OK.
> Further investigating shows the error in my own code (out of range access).
> The following exception was catched in the try {} section in findAdv(), so 
> the only
> message was: "Invalid regular expression!". This was misleading.

Indeed that's not very helpful. Ideally it would say *why* it is not valid.

> Committed at 8c67cb8c.

Nice.

Scott

Attachment: signature.asc
Description: PGP signature

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to