From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id DFCF6D15E for ; Sun, 24 Jul 2005 20:37:50 +0200 (CEST) Received: from web30506.mail.mud.yahoo.com (web30506.mail.mud.yahoo.com [68.142.200.119]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id j6OIbnp0010797 for ; Sun, 24 Jul 2005 20:37:50 +0200 Received: (qmail 34101 invoked by uid 60001); 24 Jul 2005 18:37:49 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=csQy/bOoUNx0UcevB0nlzNv6p0RVtlsev0BwHi7Ib0plGvfV1XjiQu4fXTbR21rHhwOvptW4j2nDzKu3shhOUFbbUZfZVz8jMxWfD8rjANdr1OBz1NqBprj4YAWWXLpo94JKXe3WYLhDmetDg3hOHvGlFdbYhvNQFIqdumKbyeo= ; Message-ID: <20050724183749.34099.qmail@web30506.mail.mud.yahoo.com> Received: from [69.129.110.8] by web30506.mail.mud.yahoo.com via HTTP; Sun, 24 Jul 2005 11:37:49 PDT Date: Sun, 24 Jul 2005 11:37:49 -0700 (PDT) From: David Thomas Subject: Text.get/Text.search in labltk To: caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Miltered: at nez-perce with ID 42E3DFFD.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; labltk:01 bug:01 foo:01 foo:01 rec:01 regexp:01 char:01 printf:01 printf:01 a-za-z:02 match:02 somewhere:02 seems:03 pattern:03 library:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.2 required=5.0 tests=FORGED_YAHOO_RCVD autolearn=disabled version=3.0.3 I've run into an interesting issue. There's a bug somewhere, but I've no clue whether it's in my code or the library. The code below *should* (I think) print the second word in the text box along with it's location. However, when I run it with "foo bar" in the text box, I get "(1, 4) -> foo" and I can't figure out why. If I run it with "foo bar" I get "(1, 7) -> foo" so it definately seems to be finding the location of the second word, but not getting it correctly. I've been fussing with it, and can't figure out what I'm doing wrong, if anything. Anyone have any notions? The code: let rec printwords () = match Text.search ~switches:[`Regexp] ~pattern:"[a-zA-Z]" ~start:(`Atxy (0, 0), [`Wordend; `Char 1]) text with `Linechar (l, c) -> Printf.printf "(%d, %d) -> %s\n%!" l c (Text.get ~start:(`Atxy (l+1, c), []) ~stop:(`Atxy (l, c), [`Lineend]) text );; ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs