We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Capturing & Non-Capturing Groups
Capturing & Non-Capturing Groups
Sort by
recency
|
66 Discussions
|
Please Login in order to post a comment
2 Valid Patterns
The literal pattern is simply:
However, the description leaves a clue for using a non-capture group to help with this pattern.
The non-capture group pattern is:
Testing against 6 "ok" values
When testing the string input
okokokokokok
against these 2 patterns, the same 2 matches are returned:Matches Returned:
Regarding Issues with other Patterns
I noticed a few submissions that return true on matches, but they either produce the wrong number of matches or invalid match values.
Invalid Pattern Returns 4 Matches instead of 2:
Matches Returned:
Invalid Pattern Returns wrong values:
Matches Returned:
Regex_Pattern = r'(ok){3,}' # Do not delete 'r'.
Java 15: