Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-01-16 (19:01)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] ANNOUNCE: mod_caml 1.0.6 - includes security patch
On Fri, 16 Jan 2004, Brian Hurt wrote:
> That (or something close to that) could be done via a library.  What I'd 
> like to see is to be able to pattern match on regexs, like:
> match str with
> 	| /ab+/ -> ...
> 	| /foo(bar)*/ -> ...
> etc.  The compiler could then combine all the matchings into a single DFA, 
> improving performance over code like:
> if (regex_match str "ab+") then
>     ...
> else if (regex_match str "foo(bar)*") then
>     ...
> else 
>     ...

I'd like to point out that PCRE-OCaml has functionality for using
callouts, i.e. you can indeed put all alternatives into one huge regular
expression, mark them with callout numbers, and thus execute code (a
closure passed to the matching engine) depending on the currently matched
alternative (and even explicitly backtrack if you want). Very powerful...

Unfortunately, the automaton used internally by PCRE is not a DFA.
It's still optimized to some extent, but I don't know the details.


Markus Mottl

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: