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] Str Shortest Match
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-05 (03:26)
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 Archives:
Bug reports: FAQ:
Beginner's list: