Version française
Home     About     Download     Resources     Contact us    
Browse thread
Str.string_match incorrect
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: William Lovas <wlovas@s...>
Subject: Re: [Caml-list] Str.string_match incorrect
On Sat, Dec 25, 2004 at 11:57:05AM +1100, skaller wrote:
> On Sat, 2004-12-25 at 04:40, Christopher A. Watford wrote:
> 
> > Going by PCRE's documentation 
> 
> no idea why I would do that ...
> 
> > Str.string_match (Str.regexp "a") "ab" 0 ;;
> > 
> > And in PCRE /a/ matches "ab" or "aa" or "ba".
> 
> # Str.string_match (Str.regexp "a") "xax" 0;;
> - : bool = false

*That* i would call a bug.  I think that of

    Str.string_match (Str.regexp "a") "xa" 0;;
    Str.string_match (Str.regexp "a") "ax" 0;;

either both should evaluate to true, or neither should.  Both evaluating to
true would match the typical perl/grep/etc. notion of searching anywhere
inside a string to for a matching substring, whereas neither doing so would
correspond to the mathematical notion of containment in the language of a
regular expression.

William