mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
Previously regex simplify function made an attempt to parse string representation of simplified regex. And it could produce runtime panic due to std lib specification: ``` // Simplify returns a regexp equivalent to re but without counted repetitions // and with various other simplifications, such as rewriting /(?:a+)+/ to /a+/. // The resulting regexp will execute correctly but its string representation // will not produce the same parse tree, because capturing parentheses // may have been duplicated or removed. ``` This commit ignores simplified regex parsing error and returns back original regex. It results into possible missing simplification of some niche regex patterns. But it's extremely rare cases rarely seen in production. So the tradeoff is acceptable. Fixes victoriaMetrics/victoriaLogs/issues/1112