regular expression optimization #3576
Unanswered
Bananeweizen
asked this question in
Ideas
Replies: 1 comment
-
Hi @Bananeweizen ! We don't yet have special support for regular expressions, but we could consider it if there's more use cases, much like we already treat SQL statements differently in https://github.com/openrewrite/rewrite-sql . It'll be key to keep up the do no harm while making change though, which could quickly become complicated to figure out what is really matched and used. Do let us know though if you see any good candidates for recipes and improvements of often repeated patterns! Any start to this would likely be a simple recipe, that we can then start to combine with others in a declarative recipe. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there already any recipe taking care of refactoring regular expression patterns? I often convert "(foo)" to "(?:foo)" for non capturing groups, and even that simple change is measurable in performance measurements. For scoping, I'm mainly interested in Javas Pattern.compile(...). While that might transferable to other languages with regex engines, I cannot imagine an easy detection of general regex patterns in arbitrary files.
Beta Was this translation helpful? Give feedback.
All reactions