Beta
RegEx Like a Boss #6: Valid Parenthesis
Description:
Create a Regular Expression that matches a string representing a valid parenthesis sequence. Three types of parenthesis will be used: ()
[]
{}
. The string could also contain alphanumeric characters and spaces.
The pypi regex
engine will be used that is more powerful than re
. Matching with regex.match()
Should match:
()
()()
(())
{}
[]
{()}
[]
[{()}]
[{}()]
()
a()
(a)
()a
a ( a ) a
a
a
Should NOT match
(
)
)(
)()(
(()
(}
{]
{(})
Notes
- empty strings or alphanumerics/spaces without parenthesis are valid matches
- You´re RegEx should not be longer than 150 characters
This tools may help you:
Mathematics
Regular Expressions
Strings
Fundamentals
Algorithms
Similar Kata:
Stats:
Created | Jan 7, 2019 |
Published | Jan 16, 2019 |
Warriors Trained | 130 |
Total Skips | 2 |
Total Code Submissions | 91 |
Total Times Completed | 9 |
Python Completions | 9 |
Total Stars | 8 |
% of votes with a positive feedback rating | 50% of 3 |
Total "Very Satisfied" Votes | 1 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 3 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 6 kyu |