English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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:04)
From: Johann Spies <jspies@m...>
Subject: [Caml-list] How to use pcre
I have had very limited exposure to Perl and would like to use pcre
after reading much about it on this list.

I have looked in the documentation that comes with it, but can not
find simple examples on how to use it.  The example programs are very
impressive, but do not help me a lot to know how to use simple things
like string substitution.

Can somebody please give me a simple example on how to do the following:

How do I change a string (let s = "abcde";;) to "abcDe"?

In other words what would be the pcre equivalent of python's 

>>> t = re.sub('d','D',s)
>>> t


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