English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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