Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Str Shortest Match
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] Str Shortest Match
"Nicolas Cannasse" <warplayer@free.fr> writes:

> Is there a way to do a shortest regular expression matching using Str ?
> In Perl and many RE engines, this is done by using  .*? but it does not
> seems to work on Str.
>
> let s = "yayybyyb" in
> let r = Str.regexp "a\(.*?\)b" in
> Str.search_forward r s 0;
> Str.matched_group 1 s;
>
> => "yybyy" instead of "yy"

Why not to use Pcre module then?

- Dmitry Bely


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners