On 14-09-29 21:04:17, Tom Ridge wrote: > Dear All, > I am trying to use the Str module to match regular expressions. I want to > return the longest match. > let txt = "ab" > let reg = "a\\|ab" > let _ =A > A let b = Str.string_match (Str.regexp reg) txt 0 in > A Str.matched_string txt > After the last line, the string "a" is apparently matched. But I hope that > the result should be "ab". If I reverse the order of the alternatives in > the regular expression, the string "ab" is matched. I don't want the order > of the alternatives to matter. What am I doing wrong? What can I do to > match the longest substring? > Thanks > Tom Hello, I had the same problem just last week and almost wrote the same mail. This is at least a bug in the documentation ? Cheers, Christophe -- Christophe Raffalli Universite de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tel: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature. The public key is stored on www.keyserver.net ---------------------------------------------