Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are named capture groups supported by TeaVM when using java.util.regex.Pattern? #952

Open
jakrous opened this issue Sep 18, 2024 · 1 comment

Comments

@jakrous
Copy link

jakrous commented Sep 18, 2024

My Java implementation using java.util.regex.Pattern is able to process a regex with a named capture group such as "(?<year>\\d{4})" however when I attempt to pass this regex to the JSExport-ed JavaScript function, I am met with an error without additional context.

For added context, I have a simple Java function named findMatches. This function performs a straightforward regex test and returns the list of matches. I've annotated this function with @JSExport and use the resulting JavaScript file in my React app. Unnamed capture groups and other regular expressions are processed without issue. Named capture groups unfortunately fail.

Is there a limitation within TeaVm that may be causing this?

@konsoletyper
Copy link
Owner

Yes, there are some limitations of regexes in TeaVM. The regex engine was itself taken from Harmony, which stuck at Java 7. Although I constantly improve some parts of Java standard library to fit latest Java specs, with regex I never had a chance to make improvements (and I doubt if have one in observable future).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants