Re: Ann: regex pack
"Richard A. O'Keefe" <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 14/09/2013, at 7:49 AM, Michael Hendricks wrote: > I love DCGs as much as the next Prolog fan, but sometimes a tiny regular > expression will do the job. Or perhaps regular expressions are part of > your app's UI. Anyway, this > pack<http://www.swi-prolog.org/pack/list?p=regex>supports many > features of Perl compatible regex (see link for full support). Oh dear. The huge merit of regular expressions is that they take linear time. The huge defect of Perl irregular expressions is that they can take exponential time. Already with POSIX regular expressions I've found it easier to write a DCG than to debug a mass of backslashes; Perl makes it an order of magnitude worse. If accepting regular expressions of a particular kind is part of an interface that you have to implement, you don't have much choice. Apart from that, if you can plug re2 in, why would you want anything else? Didn't Peter Schachte write a regular expression library for Prolog?