• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
July 18, 2024 |10.0K Views

String matching where one string contains wildcard characters

  Share   Like
Description
Discussion

Given two strings where first string may contain wild card characters and second string is a normal string. Write a function that returns true if the two strings match. The following are allowed wild card characters in first string.

* --> Matches with 0 or more instances of any character or set of characters.
? --> Matches with any one character.
For example, “g*ks” matches with “geeks” match. And string “ge?ks*” matches with “geeksforgeeks” (note ‘*’ at the end of first string). But “g*k” doesn’t match with “gee” as character ‘k’ is not present in second string.

String matching where one string contains wildcard characters: https://www.geeksforgeeks.org/wildcard-character-matching/