Problem with standard regex

Kornel Benko kornel at lyx.org
Sat Jan 2 17:45:21 UTC 2021


Am Sat, 2 Jan 2021 09:23:00 -0500
schrieb Scott Kostyshak <skostysh at 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.

Committed at 8c67cb8c.

	Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210102/53620297/attachment.asc>


More information about the lyx-devel mailing list