6 kyu
regex pattern to check if string has all characters
405 of 918albertogcmr
Description:
Task:
Your function should return a valid regular expression. This is a pattern which is normally used to match parts of a string. In this case will be used to check if all the characters given in the input appear in a string.
Input
Non empty string of unique alphabet characters upper and lower case.
Output
Regular expression pattern string.
Examples
Your function should return a string.
# Function example
def regex_contains_all(st):
return r"abc"
That regex pattern will be tested like this.
# Test
abc = 'abc'
pattern = regex_contains_all(abc)
st = 'zzzaaacccbbbzzz'
bool(re.match(pattern, st), f"Testing if {st} contains all characters in {abc} with your pattern {pattern}") -> True
Regular Expressions
Fundamentals
Strings
Similar Kata:
Stats:
Created | Feb 20, 2020 |
Published | Apr 3, 2020 |
Warriors Trained | 3230 |
Total Skips | 97 |
Total Code Submissions | 6113 |
Total Times Completed | 918 |
Python Completions | 405 |
JavaScript Completions | 347 |
Java Completions | 162 |
Ruby Completions | 53 |
Total Stars | 57 |
% of votes with a positive feedback rating | 88% of 213 |
Total "Very Satisfied" Votes | 174 |
Total "Somewhat Satisfied" Votes | 29 |
Total "Not Satisfied" Votes | 10 |
Total Rank Assessments | 20 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |