Support rhs variables
Closed this issue · 2 comments
Apparently variables are not supported on the right-hand side of the =~
operator:
?- Pattern = '[a-z]', S = 'a', S =~ '[a-z]'.
Pattern = '[a-z]',
S = a.
?- Pattern = '[a-z]', S = 'a', S =~ Pattern.
false.
I am not sure whether this is a bug or as designed.
It is possible to use regex/4
instead, which trivially supports variables: regex(Pattern,[],S,_)
. Nevertheless, regex/4
is not documented in the README at all :)
Thanks for letting me know. It looks like a bug to me. =~
is supposed to be sugar on top of regex/4
so they should be functionally equivalent. Unfortunately, I'm traveling for the next couple weeks and don't have access to an SWI-Prolog installation for testing a fix. If you have any time to investigate further, that'd be great.
Nevertheless, regex/4 is not documented in the README at all
The README is designed to give a summary of the package rather than a complete specification. The full documentation does mention regex/4.
Fixed in release v0.3.3