[Zope] Using RegEx in Script(Python)

Paul Winkler pw_lists@slinkp.com
Thu, 26 Jun 2003 19:59:32 -0400


On Fri, Jun 27, 2003 at 01:09:27AM +0200, Andreas Pakulat wrote:
> Hi,
> 
> 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.

yes, you can use regular expressions in an External Method.

I think you could also do it in a script by using the string.translate
method. See the python standard lib docs.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's POLY IDEAS X!
(random hero from isometric.spaceninja.com)