Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2001-09-06 (13:45)
From: Johann Spies <jspies@m...>
Subject: Re: [Caml-list] How to use pcre

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;)


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:  FAQ:
To unsubscribe, mail  Archives: