Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamllex regexp problem
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jake Donham <jake.donham@s...>
Subject: Re: ocamllex regexp problem
On Tue, Mar 18, 2008 at 7:03 PM, Jake Donham <jake.donham@skydeck.com>
wrote:

>   let ends_sq = [^']']* ']'
>   let ends_sq_sq = ends_sq ([^']'] ends_sq)* ']'+
>   let ends_sq_sq_ang = ends_sq_sq ([^'>'] ends_sq_sq)* '>'


My colleague Haoyang Wang points out that my regexp, when viewed
nondeterministically, matches "foo]]]>bar]]>", since ']'+ may match only
"]]", then [^'>'] matches the third "]". Changing it to [^'>'']'] repairs
it. So I guess the answer is that Micmatch on PCRE treats the regexp as
greedy, while ocamllex does not.

Thanks to those who replied,

Jake