Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-05 Thread spir
Le Tue, 05 May 2009 22:11:22 +1000, Lie Ryan s'exprima ainsi: > Idea: > Overrides the operator on Pattern class so we could write it like: > P("Hello") & P("World") instead of AND(P("Hello"), P("World")) You could also override directly all python logical ops to allow direct expression of logi

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-05 Thread Lie Ryan
Kent Johnson wrote: On Tue, May 5, 2009 at 8:11 AM, Lie Ryan wrote: Bring on your hardest searches... Nice! The Suite class is only there to turn the NotFound sentinel from len(text) to -1 (used len(text) since it simplifies the code a lot...) How does this simplify the code? Why not use

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-05 Thread Kent Johnson
On Tue, May 5, 2009 at 8:11 AM, Lie Ryan wrote: > Bring on your hardest searches... Nice! > The Suite class is only there to turn the NotFound sentinel from len(text) > to -1 (used len(text) since it simplifies the code a lot...) How does this simplify the code? Why not use the 'in' operator a

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-05 Thread Lie Ryan
Alex Feddor wrote: Hi I am looking for method enables advanced text string search. Method string.find() or re module seems no supporting what I am looking for. The idea is as follows: Text ="FDA meeting was successful. New drug is approved for whole sale distribution!" I would like to sc

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread C or L Smith
>> From: Alex Feddor >> >> I am looking for method enables advanced text string search. Method >> string.find() or re module seems no supporting what I am looking >> for. The idea is as follows: >> >> Text ="FDA meeting was successful. New drug is approved for whole >> sale distribution!" >> >

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread Kent Johnson
On Mon, May 4, 2009 at 12:38 PM, vince spicer wrote: > Advanced Strings searches are Regex via re module. > > EX: > > import re > > m = re.compile("(FDA.*?(approved| > supported)|Ben[^\s])*") > > if m.search(Text): >     print m.search(Text).group() This won't match "approved FDA" which may be de

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread Kent Johnson
On Mon, May 4, 2009 at 8:45 AM, Alex Feddor wrote: > Hi > > I am looking for method enables advanced text string search. Method > string.find() or re module seems no  supporting what I am looking for. The > idea is as follows: > > Text ="FDA meeting was successful. New drug is approved for whole s

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread spir
Le Mon, 4 May 2009 10:38:31 -0600, vince spicer s'exprima ainsi: > Advanced Strings searches are Regex via re module. > > EX: > > import re > > m = re.compile("(FDA.*?(approved|supported)|Ben[^\s])*") > > if m.search(Text): > print m.search(Text).group() > > > Vince This is not at all

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread Emile van Sebille
On 5/4/2009 11:03 AM Alan Gauld said... "Alex Feddor" wrote I am looking for method enables advanced text string search. Method string.find() or re module seems no supporting what I am looking for. The idea is as follows: The re module almost certainly can do what you want but regex are n

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread Alan Gauld
"Alex Feddor" wrote I am looking for method enables advanced text string search. Method string.find() or re module seems no supporting what I am looking for. The idea is as follows: The re module almost certainly can do what you want but regex are notoriously hard to master and often obscu

Re: [Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread vince spicer
Advanced Strings searches are Regex via re module. EX: import re m = re.compile("(FDA.*?(approved|supported)|Ben[^\s])*") if m.search(Text): print m.search(Text).group() Vince On Mon, May 4, 2009 at 6:45 AM, Alex Feddor wrote: > Hi > > I am looking for method enables advanced text str

[Tutor] Advanced String Search using operators AND, OR etc..

2009-05-04 Thread Alex Feddor
Hi I am looking for method enables advanced text string search. Method string.find() or re module seems no supporting what I am looking for. The idea is as follows: Text ="FDA meeting was successful. New drug is approved for whole sale distribution!" I would like to scan the text using AND and