Wildcard Matching
Lesson 15 of 15 in Coddy's Recursion Challenges - Master The Recursive Thinking course.
Challenge
HardWrite a function named test that gets a string s and a pattern p and returns true if the pattern matches the string, otherwise false.
The pattern can contain letters, numbers, white spaces and the following wildcards,
*- match any sequence of letters, numbers and white spaces..- match exactly one letter, number or white space.?- optionally match any sequence of letters, numbers and white spaces.
Examples,
test("My name is Jake", "My name is *")->truetest("My name is Jake", "Your name is *")->falsetest("Maximum", "M..imum")->truetest("Mimum", "M?imum")->truetest("Minimum", "K?imum")->false
The pattern must match all the string, not partial substring!
Try it yourself
int test(char* s, char* p) {
// Write code here
}