From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA09252; Thu, 6 Sep 2001 15:45:11 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA09097 for ; Thu, 6 Sep 2001 15:45:10 +0200 (MET DST) Received: from maties2.sun.ac.za (maties2.sun.ac.za [146.232.128.10]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f86Dj4L04244 for ; Thu, 6 Sep 2001 15:45:04 +0200 (MET DST) Received: from bywoner.sun.ac.za ([146.232.129.121]) by maties2.sun.ac.za with esmtp (Exim 3.33 #1) id 15ezSj-0008HO-00 for caml-list@inria.fr; Thu, 06 Sep 2001 15:44:57 +0200 Received: from js by bywoner.sun.ac.za with local (Exim 3.22 #1 (Debian)) id 15ezSj-0003ro-00 for ; Thu, 06 Sep 2001 15:44:57 +0200 To: ocaml mailing list Subject: Re: [Caml-list] How to use pcre References: <87pu94lbdt.fsf@bywoner.sun.ac.za> <20010906152958.B24260@chopin.ai.univie.ac.at> From: Johann Spies Date: 06 Sep 2001 15:44:57 +0200 In-Reply-To: Markus Mottl's message of "Thu, 6 Sep 2001 15:29:58 +0200" Message-ID: <874rqgl9gm.fsf@bywoner.sun.ac.za> User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Markus Mottl writes: > You could use this: > > let t = Pcre.replace ~pat:"d" ~templ:"D" s;; ... Thanks Markus. > This example is actually far too simple to be solved with the Pcre. It > does not even make use of regular expressions or substitution patterns. > Some kind of map-function for strings would be more appropriate here, > e.g.: OK. But this was just an example. I wanted to get the usage of Pcre.replace. Your map-function is fine as long as the replacement and the pattern has the same length. I suppose one can write an map function for a case where there replacement has a different length, but why should I if I can use pcre? Maybe I will try some day to get some more insight into ocaml;) Regards. Johann -- Johann Spies Telefoon: 021-808 4036 Informasietegnologie, Universiteit van Stellenbosch "Behold, I stand at the door, and knock; if any man hear my voice, and open the door, I will come in to him, and will sup with him, and he with me." Revelation 3:20 ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr