caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Pcre Confusion.
@ 2002-11-24 16:25 Ceri Storey
  2002-11-24 21:14 ` Markus Mottl
  0 siblings, 1 reply; 2+ messages in thread
From: Ceri Storey @ 2002-11-24 16:25 UTC (permalink / raw)
  To: caml-list

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 :)
-- 
Ceri Storey <cez@compsoc.man.ac.uk>
-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Pcre Confusion.
  2002-11-24 16:25 [Caml-list] Pcre Confusion Ceri Storey
@ 2002-11-24 21:14 ` Markus Mottl
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Mottl @ 2002-11-24 21:14 UTC (permalink / raw)
  To: Ceri Storey; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-24 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-24 16:25 [Caml-list] Pcre Confusion Ceri Storey
2002-11-24 21:14 ` Markus Mottl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).