Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Pcre Confusion.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Pcre Confusion.
On Sun, 24 Nov 2002, Ceri Storey wrote:
> Hi. I don't understand how pcre_full split is supposed to return Group
> results:
> 
> # let rex = regexp "([A-Z][a-z]*)|([0-9]+)";;
> val rex : Pcre.regexp = <abstr>
> # Pcre.full_split ~rex:rex "Foo bar 42";;
> - : Pcre.split_result list =
> [Delim "Foo"; Group (1, "Foo"); NoGroup; Text " bar "; Delim "42"]
> 
> I don't see why there's no Group for the last Delim. If someone could
> enlighten me, I'd be most grateful :)

Simple reason: it's a bug :-)

The true result is:

  [Pcre.Delim "Foo"; Pcre.Group (1, "Foo"); Pcre.NoGroup; Pcre.Text " bar ";
   Pcre.Delim "42"; Pcre.NoGroup; Pcre.Group (2, "42")]

I have patched PCRE-OCaml so if you want to fix this, please upgrade!

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
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