January 09, 2025 |13.1K 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/