mndrix/regex

support ^ pattern

Opened this issue · 4 comments

This pattern either matches the start of the string (without /m) or matches immediately following a newline (with /m).

There are several todo tests is the suite that describe some of its proper behavior. We need more tests too.

Hi Michael,
^ produces an error (i assume it was working). I tried your test example

?- begin =~ '^beg'.
ERROR: Domain error: `regex' expected, found `'^beg''
ERROR: In:
ERROR:   [10] throw(error(domain_error(regex,'^beg'),_5168))
ERROR:    [7] <user>
ERROR: 
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.

?- version.
Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.0-rc2)

i assume it was working

This feature has never worked quite right. That's why there's an issue for it. If you need reliable support for ^, your best bet is to use SWI-Prolog's builtin regex library

Thanks, and no problem.

Note to anyone else who ends up in this ticket:

The pcre module was previously a pain in the 7.4.x series, I never got it working on OS X.

This is now bundled by default in the stable 7.6.x series, and seems to work great.