pattern matching using regular expressions 
Author Message
 pattern matching using regular expressions

Does anyone know if there is an available Prolog implementation of a
regular expression
pattern matcher?  What I'm thinking of is something like a predicate

regexp(..,RegExp,...)

where RegExp is a regular expression (data type: string ?).  The
predicate succeeds if the current input stream satisfies the regular
expression specified.  (Is this the right terminology?)  For all I know,
something like this may be implemented in Quintus' standard library.
(I'm using LPA.)

Failing that, how about some pointers on good info sources regarding the
implementation of finite automata in Prolog.

-- Thanks, D

*******************************
David Jennings
Dept. of Philosophy/AI Center
(706) 549-1137
http://www.*-*-*.com/ ~djenning
University of Georgia
*******************************



Sat, 21 Oct 2000 03:00:00 GMT  
 pattern matching using regular expressions

Quote:

> Does anyone know if there is an available Prolog implementation of a
> regular expression
> pattern matcher?  What I'm thinking of is something like a predicate
> regexp(..,RegExp,...)
> where RegExp is a regular expression (data type: string ?).  The
> predicate succeeds if the current input stream satisfies the regular
> expression specified.  (Is this the right terminology?)  For all I know,
> something like this may be implemented in Quintus' standard library.
> (I'm using LPA.)

cf http://www.let.rug.nl/~vannoord/Fsa/

it includes the functionality you describe, although its focus is
somewhat different.

--
dr Gertjan van Noord Alfa-informatica, RUG, Postbus 716, 9700 AS Groningen
vannoord at let dot rug dot nl            http://www.let.rug.nl/~vannoord/



Sun, 22 Oct 2000 03:00:00 GMT  
 pattern matching using regular expressions

I fancy using the gnu regular expression library, rx. It is very finely
tuned, and widely used. It implements the POSIX standard. Perl uses it. So
does the application I find myself working on these days, EdgarScan.

See http://www.dc.turkuamk.fi/docs/gnu/rx/rx_toc.html and
ftp://ftp.gnu.org//pub/gnu/rx-1.5.tar.gz



Thu, 26 Oct 2000 03:00:00 GMT  
 pattern matching using regular expressions

Quote:

> I fancy using the gnu regular expression library, rx. It is very finely
> tuned, and widely used. It implements the POSIX standard. Perl uses it. So
> does the application I find myself working on these days, EdgarScan.

according to J. Friedl, "Mastering Regular Expressions", O'Reilly 1997,
Perl does not use this (or any other) library, and neither are Perl
regular expression POSIX complient.

Quote:
> See http://www.dc.turkuamk.fi/docs/gnu/rx/rx_toc.html and
> ftp://ftp.gnu.org//pub/gnu/rx-1.5.tar.gz

anyone implemented an interface to Prolog?

--
dr Gertjan van Noord Alfa-informatica, RUG, Postbus 716, 9700 AS Groningen
vannoord at let dot rug dot nl            http://www.let.rug.nl/~vannoord/



Fri, 27 Oct 2000 03:00:00 GMT  
 pattern matching using regular expressions


Quote:


> > I fancy using the gnu regular expression library, rx. It is very finely
> > tuned, and widely used. It implements the POSIX standard. Perl uses it. So
> > does the application I find myself working on these days, EdgarScan.

> according to J. Friedl, "Mastering Regular Expressions", O'Reilly 1997,
> Perl does not use this (or any other) library, and neither are Perl
> regular expression POSIX complient.

Really? I stand corrected. Thanks.

Quote:
> > See http://www.*-*-*.com/
> > ftp://ftp.gnu.org//pub/gnu/rx-1.5.tar.gz

> anyone implemented an interface to Prolog?

Yes. My illustrious predesessor, Don Ferguson. It is a rather {*filter*}, but
manly, implementation and I can post it if you like. I haven't the source
with me now but since there is a compilation step that mallocs memory, the
only way to safely use it is with the blessing of a trail hook.

rx is actually three different regular expression libraries. The one used
by emacs, a different library implementing the posix standard, and a new
implementation of emacs regular expressions based on the same source as
the posix implementation. Don couldn't get the new stuff working so it is
based on the emacs version. Since then I've discovered that there are some
very subtle memory leaks in the thing. I've also *heard* that the new rx
stuff is much faster at matching, but slower at compilation of regular
expressions. A quick peek at DejaNews indicates that there are very subtle
memory leaks in the new stuff too.



Tue, 31 Oct 2000 03:00:00 GMT  
 pattern matching using regular expressions

Quote:




> > > I fancy using the gnu regular expression library, rx.
> > > See http://www.*-*-*.com/
> > > ftp://ftp.gnu.org//pub/gnu/rx-1.5.tar.gz

> > anyone implemented an interface to Prolog?
> Yes. My illustrious predesessor, Don Ferguson. It is a rather {*filter*}, but
> manly, implementation and I can post it if you like. I haven't the source
> with me now but since there is a compilation step that mallocs memory, the
> only way to safely use it is with the blessing of a trail hook.

I've no idea what a trail hook is. I would be interested in interfacing it
with SICStus Prolog. It may be worthwhile to post the source you have to
the net.

--
dr Gertjan van Noord Alfa-informatica, RUG, Postbus 716, 9700 AS Groningen
vannoord at let dot rug dot nl             http://www.*-*-*.com/ ~vannoord/



Thu, 02 Nov 2000 03:00:00 GMT  
 pattern matching using regular expressions


Quote:

> I've no idea what a trail hook is.

A trail hook is an entry in the trail that instead of resetting a variable
binding as normal trail entries do, calls some user-specified code to tidy
up (eg. free resources) on backtracking.

-- F



Fri, 03 Nov 2000 03:00:00 GMT  
 pattern matching using regular expressions

Quote:



>> I've no idea what a trail hook is.
>A trail hook is an entry in the trail that instead of resetting a variable
>binding as normal trail entries do, calls some user-specified code to tidy
>up (eg. free resources) on backtracking.

For example, see
<http://www.cs.mu.oz.au/research/mercury/doc/reference_manual_12.html#...>.

--

WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"



Sat, 04 Nov 2000 03:00:00 GMT  
 pattern matching using regular expressions

Quote:
> .. about interface between Prolog and regular expression library ..

I've now implemented an interface between SICStus Prolog 3 and the
POSIX regular expression functions regcomp(3), regexec(3), regerror(3)
and regfree(3).

It's tested with HP-UX 10.20 (the regular expression functions
are in standard library), but it should work with any POSIX rx, e.g.
GNU rx.

You can get it from
    ftp://ftp.let.rug.nl/~vannoord/prolog-rx/prolog-rx.tar.gz

technical note: it doesn't use a trail-hook to free compiled patterns that
are not used anymore (I didn't know how to do that in SICStus). As an
alternative, it provides a predicate regfree/1 that will free a pattern
explicitly (not very Prolog-ish, I admit).

--
dr Gertjan van Noord Alfa-informatica, RUG, Postbus 716, 9700 AS Groningen
vannoord at let dot rug dot nl            http://www.let.rug.nl/~vannoord/



Sun, 05 Nov 2000 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. iss-matching - the free Regular Expression / Pattern Matching cluster

2. Regular Expression for Match Pattern (string) Function

3. Bug in regular expression pattern matching?

4. Regular expression string pattern matching: Embedding pop-11 procedures, and more

5. Pattern-matching regular-expression algorithm?

6. Regular Expression Pattern Matching "State" Object

7. Regular expressions, pattern matching

8. regular expression matching in J ? (or APL)

9. Regular Expression to match HTML elements

10. regular expression: matching ( )

11. Regular expression matching with Halstenbach's REGEXP

12. Binding style and the universality of REs (was: Regular Expression Matching)

 

 
Powered by phpBB® Forum Software