SSL Server Socket Support in Python?

2005-04-22 Thread André Søreng
I'm trying to create a SSL-enabled server in Python, and in the doc for the socket module: ssl(sock[, keyfile, certfile]) Initiate a SSL connection over the socket sock. keyfile is the name of a PEM formatted file that contains your private key. certfile is a PEM formatted certificate

Re: RE Engine error with sub()

2005-04-15 Thread André Søreng
Instead of using regular expressions, you could perhaps use a multiple keyword matcher, and then for each match, replace it with the correct string. http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/ contains the Aho-Corasick algorithm written in C with a Python extension. Maurice LING wrote:

Re: RE Engine error with sub()

2005-04-15 Thread André Søreng
The Internal error in regular expression engine occurs also in Python 2.4.0 when creating a regular expression containing more than or's (|). Dennis Benzinger wrote: Maurice LING schrieb: Hi, I have the following codes: from __future__ import nested_scopes [...] Are you still using Python

Overlapping matches in Regular Expressions

2005-04-12 Thread André Søreng
With the re/sre module included with Python 2.4: pattern = (?Pid1avi)|(?Pid2avi|mp3) string2match = some string with avi in it matches = re.finditer(pattern, string2match) ... matches[0].groupdict() {'id2': None, 'id1': 'avi'} Which was expected since overlapping matches are ignored. But I would

Re: monitoring folder in python

2005-04-05 Thread André Søreng
Raghul wrote: Is it possible to monitor a folder in the python?My question is if I put any file in it that particular folder my script should monitor the folder and read the file name.If so what function can I use? Thanx in advance If you do not want to poll (check for changes yourself regularly),

Re: Regular Expressions: large amount of or's

2005-03-02 Thread André Søreng
Bill Mill wrote: On Tue, 01 Mar 2005 22:04:15 +0100, André Søreng [EMAIL PROTECTED] wrote: Kent Johnson wrote: André Søreng wrote: Hi! Given a string, I want to find all ocurrences of certain predefined words in that string. Problem is, the list of words that should be detected can

Re: Regular Expressions: large amount of or's

2005-03-02 Thread André Søreng
Daniel Yoo wrote: Kent Johnson [EMAIL PROTECTED] wrote: : Given a string, I want to find all ocurrences of : certain predefined words in that string. Problem is, the list of : words that should be detected can be in the order of thousands. : : With the re module, this can be solved something like

Re: Regular Expressions: large amount of or's

2005-03-02 Thread André Søreng
Ola Natvig wrote: André Søreng wrote: Yes, but I was looking for a solution which would scale. Searching through the same string 1+++ times does not seem like a suitable solution. André Just for curiosity, what would a regexp do? Perhaps it's a clue in how you could do this in the way

Regular Expressions: large amount of or's

2005-03-01 Thread André Søreng
Hi! Given a string, I want to find all ocurrences of certain predefined words in that string. Problem is, the list of words that should be detected can be in the order of thousands. With the re module, this can be solved something like this: import re r =

Re: Regular Expressions: large amount of or's

2005-03-01 Thread André Søreng
Kent Johnson wrote: André Søreng wrote: Hi! Given a string, I want to find all ocurrences of certain predefined words in that string. Problem is, the list of words that should be detected can be in the order of thousands. With the re module, this can be solved something like this: import re r