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: Nicolas Cannasse <warplayer@f...>
Subject: [Caml-list] Str Shortest Match
Hi everyone,

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"

Nicolas Cannasse

-------------------
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