Problem with standard regex

Scott Kostyshak skostysh at lyx.org
Sat Jan 2 14:23:00 UTC 2021


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210102/eb396021/attachment.asc>


More information about the lyx-devel mailing list