Created
May 13, 2021 02:10
-
-
Save alexcmgit/073630b6a7a2cf124b6b2a36796810ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Checks if [source] contains all the characters of [text] in the correct order | |
/// | |
/// Example: | |
/// ``` | |
/// hasMatch('abcdef', 'adf') // true | |
/// hasMatch('dbcaef', 'adf') // false | |
/// ``` | |
bool hasWildcardMatch(String source, String text) { | |
final regexp = text.split('').join('.*'); | |
return RegExp(regexp).hasMatch(source); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment