[prev in list] [next in list] [prev in thread] [next in thread]
List: zope
Subject: Re: [Zope] Using RegEx in Script(Python)
From: Steffen Hausmann <steffen () hausmann-family ! de>
Date: 2003-06-26 23:53:27
[Download RAW message or body]
On Fri, Jun 27, 2003 at 01:09:27AM +0200, Andreas Pakulat wrote:
> I wanted to know if the above can be done? What I need is a function
> that replaces every character of a string, that is not in [a-zA-Z1-9]
> with an underscore. I want to use this to automatically create an
> Object-Id from a title, to create a new Object.
>
> If this is not possible directly within a Script(Python), can it be done
> using an ExternalMethod? I suppose yes.
In order to use regular expressions in python you need to 'import re'.
After that you can use 'sub(pattern, repl, string[, count])' to
substitue a string.
For more information on regexps in python take a look at
http://www.python.org/doc/current/lib/node99.html#l2h-732
MfG Steffen
--
Zu sagen 'Hier herrscht Freiheit' ist immer ein Irrtum oder auch eine
L|ge -- Freiheit herrscht nicht (Erich Fried)
_______________________________________________
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic