You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, calling matcher.find() in this case hangs.
Now, if I alter the pattern into \((?!\?:)[^)(]*+(?:[^)(])*+\) I still get the expected matches, and there is no more hang. I know that the behavior of the pattern is technically changed, but I control the input and it still works for all my desired cases. The standard java.util.regex impl seems to handle both cases fine. No biggie since there is a work-around, but any ideas why this hang occurs with the original pattern?
TLDR: \((?!\?:)[^)(]*+(?:[^)(])*+\) - Works \((?!\?:)[^)(]*+(?:[^)(]*)*+\) - Hangs, has one additional *
The text was updated successfully, but these errors were encountered:
I've been looking to make a regex that tells me how many groups (matching) there are in another given regex and found a pattern that looks like this:
Unfortunately, calling
matcher.find()
in this case hangs.Now, if I alter the pattern into
\((?!\?:)[^)(]*+(?:[^)(])*+\)
I still get the expected matches, and there is no more hang. I know that the behavior of the pattern is technically changed, but I control the input and it still works for all my desired cases. The standardjava.util.regex
impl seems to handle both cases fine. No biggie since there is a work-around, but any ideas why this hang occurs with the original pattern?TLDR:
\((?!\?:)[^)(]*+(?:[^)(])*+\)
- Works\((?!\?:)[^)(]*+(?:[^)(]*)*+\)
- Hangs, has one additional*
The text was updated successfully, but these errors were encountered: