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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin_jambon@e...>
Subject: [Caml-list] Match order of Str regexps
Hello,

Would it be possible to consider that:
  1. the regular expressions in the Str library are matched in a greedy
     fashion (longest match, left to right),
  2. that the regexps of an alternative are tried from left to right?

Illustration of case 1 (micmatch/ocamllex syntax):

# match "abc" with RE (_* as s1) (_* as s2) -> (s1, s2);;
- : string * string = ("abc", "")

Illustration of case 2:

# match "ab" with RE "a" | "ab" as s -> s;;
- : string = "a"


Martin

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