Matching Strings

You are given two strings as arguments. The first string will be a word or sentence, like "google". The second string will contain a wildcard character of * that will be used with a sequence of leading or following characters. Return true if both the leading character sequence and the following sequence matches the first string.

Requirements

  • Must return either true or false

Example #1

solve("google", "g*ler" )
> false

  1. We are able to match the leading character, "g" with the first argument string.
  2. We are able to match the "le" characters following the wildcard
  3. We are not able to match the "r" character, so the function returns false.

Example #2

solve("google", "go*e" )
> true
  1. We are able to match the leading characters, "go" with the first argument string.
  2. The character following the wildcard "e" matches the last character of the first string, so the function returns true.