See also the interface to the PCRE library:
Did you know ... | Search Documentation: |
Predicate wildcard_match/2 |
csh
pattern
matcher. The patterns are given below:
| Matches one arbitrary character. |
| Matches any number of arbitrary characters. |
[ ... | Matches one of the characters specified between the brackets. |
<char1>-<char2>
indicates a range. | |
{...} | Matches any of the patterns of the comma-separated list between the braces. |
Example:
?- wildcard_match('[a-z]*.{pro,pl}[%~]', 'a_hello.pl%'). true.
The wildcard_match/3 version processes the following option:
false
(default true
), match case
insensitively.See also the interface to the PCRE library:
The query:
?- wildcard_match('a*a*a*a*a*a*a*a*a*a*a*a*a*a','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab')
.
Hangs SWI-Prolog for a very very very long time.
Wildcard matching with unlimited recursion is dangerous, see: https://www.codeproject.com/Articles/5163931/Fast-String-Matching-with-Wildcards-Globs-and-Giti
-- Robert
Note that