-
Code pattern1 = r"\d|\((?R)\)" pattern2 = r"(.*)00(?1)"
Test Cases import codewars_test as test from solution import pattern1, pattern2 import regex .describe("Recursive regex") def test_group(): .it("Pattern 1") def test_case(): test.expect(regex.match(pattern1, "5")) test.expect(regex.match(pattern1, "(6)")) test.expect(regex.match(pattern1, "((((((9))))))")) .it("Pattern 2") def test_case(): test.expect(regex.match(pattern2, "110011")) test.expect(regex.match(pattern2, "abc00abc")) test.expect(regex.match(pattern2, "00"))
Output:
-
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}