Keywords searching via regexp
Eugene A.Tyurkin
hackee at penguinpowered.com
Fri Oct 27 09:55:55 EDT 2000
More information about the Python-list mailing list
Fri Oct 27 09:55:55 EDT 2000
- Previous message (by thread): Python directly on SVGA screen
- Next message (by thread): Keywords searching via regexp
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi!
Here's a task
I have a list of keywords: keywords = ['qwerty','is','a','good','keyboard']
and want to find any of them in some text
The question is: how to write correct regexp to find them?
Notice, that I don't want to find words like 'goody', I want exectly my keywords
But I also want to find strings like 'qwerty', #good# etc
Here what I've tryed:
regexp = r"[^w]*\s+(" + string.join(keywords.'|') + r")"[^\w]*\s+"
aaa = re.compile(regexp)
...
It works fine, but it never find the word at the beginnig or the end of line.
Is it possible to make it all in one?
Thanx
- Previous message (by thread): Python directly on SVGA screen
- Next message (by thread): Keywords searching via regexp
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list