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

Alex Feddor alex.feddor at gmail.com
Mon May 4 14:45:06 CEST 2009


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 OR operators and gets -1 or
other value if the searching elements haven't found in the text.
Example 01:
search criteria:  "FDA" AND ( "approve*" OR "supported")
The catch is that in Text variable FDA and approve words  are not one after
another (other words are in between).
Example 02:
search criteria: "Ben"
The catch is that code sould find only exact Ben words not also words which
that has firts three letters Ben such as Benquick, Benseek etc.. Only Ben is
the right word we are looking for.

I would really appreciated your advice - code sample / links how above can
be achieved! if possible I would appreciated solution achieved with free of
charge module.

Cheers,  Alex
PS:
A few moths ago I have discovered Python. I am amazed what all can be done
with it. Really cool programming language..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090504/bbd34b5a/attachment.htm>


More information about the Tutor mailing list