I’ve added function wildcard_compare($wildcard, $string) into YF framework, which uses php built-in fnmatch() function, which is fast and not using regexps.
There is support for these patterns:
“*” – no or any number of symbols
“?” – exactly one symbol
“[abc]” – one of symbols passed inside square brackets
YF function wildcard_compare() differs from native fnmatch(): it can accept array of wildcards and if any of them matched – then overall return true.
wildcard_compare('regex are * useful', 'regex are always useful')
Unit tests (also examples):