Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] How to use pcre
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Johann Spies <jspies@m...>
Subject: Re: [Caml-list] How to use pcre

Markus Mottl <markus@mail4.ai.univie.ac.at> 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