Hello Spir, Alan, and Paul,<br><br>Thank you for your help. I have been working on the file, but I still have a problem doing what I wanted. As a reminder,<br><br>I have<br><br><br>#!usr/bin/python<br>tags = {<br>&#39;noun-prop&#39;: &#39;noun_prop null null&#39;.split(),<br>
&#39;case_def_gen&#39;: &#39;case_def gen null&#39;.split(),<br>&#39;dem_pron_f&#39;: &#39;dem_pron f null&#39;.split(),<br>&#39;case_def_acc&#39;: &#39;case_def acc null&#39;.split(),<br>}<br><br><br>TAB = &#39;\t&#39;<br>
<br><br>def newlyTaggedWord(line):<br>       (word,tag) = line.split(TAB)    # separate parts of line, keeping data only<br>       new_tags = tags[tag]          # read in dict<br>       tagging = TAB.join(new_tags)    # join with TABs<br>
       return word + TAB + tagging   # formatted result<br><br>def replaceTagging(source_name, target_name):<br>       target_file = open(target_name, &quot;w&quot;)<br>       # replacement loop<br>       for line in open(source_name, &quot;r&quot;):<br>
           new_line = newlyTaggedWord(line) + &#39;\n&#39;<br>           target_file.write(new_line)<br>       <br>target_file.close()<br><br>if __name__ == &quot;__main__&quot;:<br>       source_name = sys.argv[1]<br>       target_name = sys.argv[2]<br>
       replaceTagging(source_name, target_name)<br><br><br><br><div class="gmail_quote">On Mon, May 4, 2009 at 12:38 PM,  <span dir="ltr">&lt;<a href="mailto:tutor-request@python.org">tutor-request@python.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Send Tutor mailing list submissions to<br>
        <a href="mailto:tutor@python.org">tutor@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:tutor-request@python.org">tutor-request@python.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:tutor-owner@python.org">tutor-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of Tutor digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Re: Iterating over a long list with regular expressions and<br>
      changing each item? (Paul McGuire)<br>
   2. Advanced String Search using operators AND, OR etc.. (Alex Feddor)<br>
   3. Re: Encode problem (Pablo P. F. de Faria)<br>
   4. Re: Encode problem (Pablo P. F. de Faria)<br>
   5. Re: Advanced String Search using operators AND, OR etc..<br>
      (vince spicer)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Mon, 4 May 2009 11:17:53 -0500<br>
From: &quot;Paul McGuire&quot; &lt;<a href="mailto:ptmcg@austin.rr.com">ptmcg@austin.rr.com</a>&gt;<br>
Subject: Re: [Tutor] Iterating over a long list with regular<br>
        expressions and changing each item?<br>
To: &lt;<a href="mailto:tutor@python.org">tutor@python.org</a>&gt;<br>
Message-ID: &lt;99B447F3C7EF4996AA2ED683F1EE6DB6@AWA2&gt;<br>
Content-Type: text/plain;       charset=&quot;us-ascii&quot;<br>
<br>
Original:<br>
 &#39;case_def_gen&#39;:[&#39;case_def&#39;,&#39;gen&#39;,&#39;null&#39;],<br>
 &#39;nsuff_fem_pl&#39;:[&#39;nsuff&#39;,&#39;null&#39;, &#39;null&#39;],<br>
 &#39;abbrev&#39;: [&#39;abbrev, null, null&#39;],<br>
 &#39;adj&#39;: [&#39;adj, null, null&#39;],<br>
 &#39;adv&#39;: [&#39;adv, null, null&#39;],}<br>
<br>
Note the values for &#39;abbrev&#39;, &#39;adj&#39; and &#39;adv&#39; are not lists, but strings<br>
containing comma-separated lists.<br>
<br>
Should be:<br>
 &#39;case_def_gen&#39;:[&#39;case_def&#39;,&#39;gen&#39;,&#39;null&#39;],<br>
 &#39;nsuff_fem_pl&#39;:[&#39;nsuff&#39;,&#39;null&#39;, &#39;null&#39;],<br>
 &#39;abbrev&#39;: [&#39;abbrev&#39;, &#39;null&#39;, &#39;null&#39;],<br>
 &#39;adj&#39;: [&#39;adj&#39;, &#39;null&#39;, &#39;null&#39;],<br>
 &#39;adv&#39;: [&#39;adv&#39;, &#39;null&#39;, &#39;null&#39;],}<br>
<br>
For much of my own code, I find lists of string literals to be tedious to<br>
enter, and easy to drop a &#39; character.  This style is a little easier on the<br>
eyes, and harder to screw up.<br>
<br>
 &#39;case_def_gen&#39;:[&#39;case_def gen null&#39;.split()],<br>
 &#39;nsuff_fem_pl&#39;:[&#39;nsuff null null&#39;.split()],<br>
 &#39;abbrev&#39;: [&#39;abbrev null null&#39;.split()],<br>
 &#39;adj&#39;: [&#39;adj null null&#39;.split()],<br>
 &#39;adv&#39;: [&#39;adv null null&#39;.split()],}<br>
<br>
Since all that your code does at runtime with the value strings is<br>
&quot;\t&quot;.join() them, then you might as well initialize the dict with these<br>
computed values, for at least some small gain in runtime performance:<br>
<br>
 T = lambda s : &quot;\t&quot;.join(s.split())<br>
 &#39;case_def_gen&#39; : T(&#39;case_def gen null&#39;),<br>
 &#39;nsuff_fem_pl&#39; : T(&#39;nsuff null null&#39;),<br>
 &#39;abbrev&#39; :       T(&#39;abbrev null null&#39;),<br>
 &#39;adj&#39; :          T(&#39;adj null null&#39;),<br>
 &#39;adv&#39; :          T(&#39;adv null null&#39;),}<br>
 del T<br>
<br>
(Yes, I know PEP8 says *not* to add spaces to line up assignments or other<br>
related values, but I think there are isolated cases where it does help to<br>
see what&#39;s going on.  You could even write this as:<br>
<br>
 T = lambda s : &quot;\t&quot;.join(s.split())<br>
 &#39;case_def_gen&#39; : T(&#39;case_def  gen  null&#39;),<br>
 &#39;nsuff_fem_pl&#39; : T(&#39;nsuff     null null&#39;),<br>
 &#39;abbrev&#39; :       T(&#39;abbrev    null null&#39;),<br>
 &#39;adj&#39; :          T(&#39;adj       null null&#39;),<br>
 &#39;adv&#39; :          T(&#39;adv       null null&#39;),}<br>
 del T<br>
<br>
and the extra spaces help you to see the individual subtags more easily,<br>
with no change in the resulting values since split() splits on multiple<br>
whitespace the same as a single space.)<br>
<br>
Of course you could simply code as:<br>
<br>
 &#39;case_def_gen&#39; : T(&#39;case_def\tgen\t null&#39;),<br>
 &#39;nsuff_fem_pl&#39; : T(&#39;nsuff\tnull\tnull&#39;),<br>
 &#39;abbrev&#39; :       T(&#39;abbrev\tnull\tnull&#39;),<br>
 &#39;adj&#39; :          T(&#39;adj\tnull\tnull&#39;),<br>
 &#39;adv&#39; :          T(&#39;adv\tnull\tnull&#39;),}<br>
<br>
But I think readability definitely suffers here, I would probably go with<br>
the penultimate version.<br>
<br>
-- Paul<br>
<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Mon, 4 May 2009 14:45:06 +0200<br>
From: Alex Feddor &lt;<a href="mailto:alex.feddor@gmail.com">alex.feddor@gmail.com</a>&gt;<br>
Subject: [Tutor] Advanced String Search using operators AND, OR etc..<br>
To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Message-ID:<br>
        &lt;<a href="mailto:5bf184e30905040545i78bc75b8ic78eabf44a55aa20@mail.gmail.com">5bf184e30905040545i78bc75b8ic78eabf44a55aa20@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
Hi<br>
<br>
I am looking for method enables advanced text string search. Method<br>
string.find() or re module seems no  supporting what I am looking for. The<br>
idea is as follows:<br>
<br>
Text =&quot;FDA meeting was successful. New drug is approved for whole sale<br>
distribution!&quot;<br>
<br>
I would like to scan the text using AND and OR operators and gets -1 or<br>
other value if the searching elements haven&#39;t found in the text.<br>
Example 01:<br>
search criteria:  &quot;FDA&quot; AND ( &quot;approve*&quot; OR &quot;supported&quot;)<br>
The catch is that in Text variable FDA and approve words  are not one after<br>
another (other words are in between).<br>
Example 02:<br>
search criteria: &quot;Ben&quot;<br>
The catch is that code sould find only exact Ben words not also words which<br>
that has firts three letters Ben such as Benquick, Benseek etc.. Only Ben is<br>
the right word we are looking for.<br>
<br>
I would really appreciated your advice - code sample / links how above can<br>
be achieved! if possible I would appreciated solution achieved with free of<br>
charge module.<br>
<br>
Cheers,  Alex<br>
PS:<br>
A few moths ago I have discovered Python. I am amazed what all can be done<br>
with it. Really cool programming language..<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://mail.python.org/pipermail/tutor/attachments/20090504/bbd34b5a/attachment-0001.htm" target="_blank">http://mail.python.org/pipermail/tutor/attachments/20090504/bbd34b5a/attachment-0001.htm</a>&gt;<br>

<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Mon, 4 May 2009 11:09:25 -0300<br>
From: &quot;Pablo P. F. de Faria&quot; &lt;<a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a>&gt;<br>
Subject: Re: [Tutor] Encode problem<br>
To: Kent Johnson &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt;<br>
Cc: *tutor python &lt;<a href="mailto:tutor@python.org">tutor@python.org</a>&gt;<br>
Message-ID:<br>
        &lt;<a href="mailto:3ea81d4c0905040709m78a45d11j2037943380817297@mail.gmail.com">3ea81d4c0905040709m78a45d11j2037943380817297@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
Thanks, Kent, but that doesn&#39;t solve my problem. In fact, I need<br>
ConfigParser to work with non-ascii characters, since my App may run<br>
in &quot;latin-1&quot; environments (folders e files names). I must find out why<br>
the str() function in the module ConfigParser doesn&#39;t use the encoding<br>
defined for the application (# -*- coding: utf-8 -*-). The rest of the<br>
application works properly with utf-8, except for ConfigParser. What I<br>
found out is that ConfigParser seems to make use of the configuration<br>
in Site.py (which is set to &#39;ascii&#39;), instead of the configuration<br>
defined for the App (if I change . But this is very problematic to<br>
have to change Site.py in every computer... So I wonder if there is a<br>
way to replace the settings in Site.py only for my App.<br>
<br>
2009/5/1 Kent Johnson &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt;:<br>
&gt; On Fri, May 1, 2009 at 4:54 PM, Pablo P. F. de Faria<br>
&gt; &lt;<a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a>&gt; wrote:<br>
&gt;&gt; Hi, Kent.<br>
&gt;&gt;<br>
&gt;&gt; The stack trace is:<br>
&gt;&gt;<br>
&gt;&gt; Traceback (most recent call last):<br>
&gt;&gt; ?File &quot;/home/pablo/workspace/E-Dictor/src/MainFrame.py&quot;, line 1057, in OnClose<br>
&gt;&gt; ? ?self.SavePreferences()<br>
&gt;&gt; ?File &quot;/home/pablo/workspace/E-Dictor/src/MainFrame.py&quot;, line 1068,<br>
&gt;&gt; in SavePreferences<br>
&gt;&gt; ? ?self.cfg.set(u&#39;File Settings&#39;,u&#39;Recent files&#39;,<br>
&gt;&gt; unicode(&quot;,&quot;.join(self.recent_files)))<br>
&gt;&gt; UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0xc3 in position<br>
&gt;&gt; 12: ordinal not in range(128)<br>
&gt;&gt;<br>
&gt;&gt; The &quot;unicode&quot; function, actually doesn&#39;t do any difference... The<br>
&gt;&gt; content of the string being saved is &quot;/home/pablo/?rea de<br>
&gt;&gt; Trabalho/teste.xml&quot;.<br>
&gt;<br>
&gt; OK, this error is in your code, not the ConfigParser. The problem is with<br>
&gt; &quot;,&quot;.join(self.recent_files)<br>
&gt;<br>
&gt; Are the entries in self.recent_files unicode strings? If so, then I<br>
&gt; think the join is trying to convert to a string using the default<br>
&gt; codec. Try<br>
&gt;<br>
&gt; self.cfg.set(&#39;File Settings&#39;,&#39;Recent files&#39;,<br>
&gt; &#39;,&#39;.join(name.encode(&#39;utf-8&#39;) for name in self.recent_files))<br>
&gt;<br>
&gt; Looking at the ConfigParser.write() code, it wants the values to be<br>
&gt; strings or convertible to strings by calling str(), so non-ascii<br>
&gt; unicode values will be a problem there. I would use plain strings for<br>
&gt; all the interaction with ConfigParser and convert to Unicode yourself.<br>
&gt;<br>
&gt; Kent<br>
&gt;<br>
&gt; PS Please Reply All to reply to the list.<br>
&gt;<br>
<br>
<br>
<br>
--<br>
---------------------------------<br>
&quot;Estamos todos na sarjeta, mas alguns de n?s olham para as estrelas.&quot;<br>
(Oscar Wilde)<br>
---------------------------------<br>
Pablo Faria<br>
Mestrando em Aquisi??o de Linguagem - IEL/Unicamp<br>
Bolsista t?cnico FAPESP no Projeto Padr?es R?tmicos e Mudan?a Ling??stica<br>
(19) 3521-1570<br>
<a href="http://www.tycho.iel.unicamp.br/%7Epablofaria/" target="_blank">http://www.tycho.iel.unicamp.br/~pablofaria/</a><br>
<a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Mon, 4 May 2009 11:11:58 -0300<br>
From: &quot;Pablo P. F. de Faria&quot; &lt;<a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a>&gt;<br>
Subject: Re: [Tutor] Encode problem<br>
To: Kent Johnson &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt;<br>
Cc: *tutor python &lt;<a href="mailto:tutor@python.org">tutor@python.org</a>&gt;<br>
Message-ID:<br>
        &lt;<a href="mailto:3ea81d4c0905040711p62376925n26fb93a8955fefe4@mail.gmail.com">3ea81d4c0905040711p62376925n26fb93a8955fefe4@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=ISO-8859-1<br>
<br>
Here is the traceback, after the last change you sugested:<br>
<br>
Traceback (most recent call last):<br>
  File &quot;/home/pablo/workspace/E-Dictor/src/MainFrame.py&quot;, line 1057, in OnClose<br>
    self.SavePreferences()<br>
  File &quot;/home/pablo/workspace/E-Dictor/src/MainFrame.py&quot;, line 1069,<br>
in SavePreferences<br>
    self.cfg.write(codecs.open(self.properties_file,&#39;w&#39;,&#39;utf-8&#39;))<br>
  File &quot;/usr/lib/python2.5/ConfigParser.py&quot;, line 373, in write<br>
    (key, str(value).replace(&#39;\n&#39;, &#39;\n\t&#39;)))<br>
  File &quot;/usr/lib/python2.5/codecs.py&quot;, line 638, in write<br>
    return self.writer.write(data)<br>
  File &quot;/usr/lib/python2.5/codecs.py&quot;, line 303, in write<br>
    data, consumed = self.encode(object, self.errors)<br>
UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0xc3 in position<br>
27: ordinal not in range(128)<br>
<br>
So, in &quot;str(value)&quot; the content is a folder name with an accented character (?).<br>
<br>
2009/5/4 Pablo P. F. de Faria &lt;<a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a>&gt;:<br>
&gt; Thanks, Kent, but that doesn&#39;t solve my problem. In fact, I need<br>
&gt; ConfigParser to work with non-ascii characters, since my App may run<br>
&gt; in &quot;latin-1&quot; environments (folders e files names). I must find out why<br>
&gt; the str() function in the module ConfigParser doesn&#39;t use the encoding<br>
&gt; defined for the application (# -*- coding: utf-8 -*-). The rest of the<br>
&gt; application works properly with utf-8, except for ConfigParser. What I<br>
&gt; found out is that ConfigParser seems to make use of the configuration<br>
&gt; in Site.py (which is set to &#39;ascii&#39;), instead of the configuration<br>
&gt; defined for the App (if I change . But this is very problematic to<br>
&gt; have to change Site.py in every computer... So I wonder if there is a<br>
&gt; way to replace the settings in Site.py only for my App.<br>
&gt;<br>
&gt; 2009/5/1 Kent Johnson &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt;:<br>
&gt;&gt; On Fri, May 1, 2009 at 4:54 PM, Pablo P. F. de Faria<br>
&gt;&gt; &lt;<a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt; Hi, Kent.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The stack trace is:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Traceback (most recent call last):<br>
&gt;&gt;&gt; ?File &quot;/home/pablo/workspace/E-Dictor/src/MainFrame.py&quot;, line 1057, in OnClose<br>
&gt;&gt;&gt; ? ?self.SavePreferences()<br>
&gt;&gt;&gt; ?File &quot;/home/pablo/workspace/E-Dictor/src/MainFrame.py&quot;, line 1068,<br>
&gt;&gt;&gt; in SavePreferences<br>
&gt;&gt;&gt; ? ?self.cfg.set(u&#39;File Settings&#39;,u&#39;Recent files&#39;,<br>
&gt;&gt;&gt; unicode(&quot;,&quot;.join(self.recent_files)))<br>
&gt;&gt;&gt; UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0xc3 in position<br>
&gt;&gt;&gt; 12: ordinal not in range(128)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The &quot;unicode&quot; function, actually doesn&#39;t do any difference... The<br>
&gt;&gt;&gt; content of the string being saved is &quot;/home/pablo/?rea de<br>
&gt;&gt;&gt; Trabalho/teste.xml&quot;.<br>
&gt;&gt;<br>
&gt;&gt; OK, this error is in your code, not the ConfigParser. The problem is with<br>
&gt;&gt; &quot;,&quot;.join(self.recent_files)<br>
&gt;&gt;<br>
&gt;&gt; Are the entries in self.recent_files unicode strings? If so, then I<br>
&gt;&gt; think the join is trying to convert to a string using the default<br>
&gt;&gt; codec. Try<br>
&gt;&gt;<br>
&gt;&gt; self.cfg.set(&#39;File Settings&#39;,&#39;Recent files&#39;,<br>
&gt;&gt; &#39;,&#39;.join(name.encode(&#39;utf-8&#39;) for name in self.recent_files))<br>
&gt;&gt;<br>
&gt;&gt; Looking at the ConfigParser.write() code, it wants the values to be<br>
&gt;&gt; strings or convertible to strings by calling str(), so non-ascii<br>
&gt;&gt; unicode values will be a problem there. I would use plain strings for<br>
&gt;&gt; all the interaction with ConfigParser and convert to Unicode yourself.<br>
&gt;&gt;<br>
&gt;&gt; Kent<br>
&gt;&gt;<br>
&gt;&gt; PS Please Reply All to reply to the list.<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; ---------------------------------<br>
&gt; &quot;Estamos todos na sarjeta, mas alguns de n?s olham para as estrelas.&quot;<br>
&gt; (Oscar Wilde)<br>
&gt; ---------------------------------<br>
&gt; Pablo Faria<br>
&gt; Mestrando em Aquisi??o de Linguagem - IEL/Unicamp<br>
&gt; Bolsista t?cnico FAPESP no Projeto Padr?es R?tmicos e Mudan?a Ling??stica<br>
&gt; (19) 3521-1570<br>
&gt; <a href="http://www.tycho.iel.unicamp.br/%7Epablofaria/" target="_blank">http://www.tycho.iel.unicamp.br/~pablofaria/</a><br>
&gt; <a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a><br>
&gt;<br>
<br>
<br>
<br>
--<br>
---------------------------------<br>
&quot;Estamos todos na sarjeta, mas alguns de n?s olham para as estrelas.&quot;<br>
(Oscar Wilde)<br>
---------------------------------<br>
Pablo Faria<br>
Mestrando em Aquisi??o de Linguagem - IEL/Unicamp<br>
Bolsista t?cnico FAPESP no Projeto Padr?es R?tmicos e Mudan?a Ling??stica<br>
(19) 3521-1570<br>
<a href="http://www.tycho.iel.unicamp.br/%7Epablofaria/" target="_blank">http://www.tycho.iel.unicamp.br/~pablofaria/</a><br>
<a href="mailto:pablofaria@gmail.com">pablofaria@gmail.com</a><br>
<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Mon, 4 May 2009 10:38:31 -0600<br>
From: vince spicer &lt;<a href="mailto:vinces1979@gmail.com">vinces1979@gmail.com</a>&gt;<br>
Subject: Re: [Tutor] Advanced String Search using operators AND, OR<br>
        etc..<br>
To: Alex Feddor &lt;<a href="mailto:alex.feddor@gmail.com">alex.feddor@gmail.com</a>&gt;<br>
Cc: <a href="mailto:tutor@python.org">tutor@python.org</a><br>
Message-ID:<br>
        &lt;<a href="mailto:1e53c510905040938q25d787f3w17f7a18f65bd0410@mail.gmail.com">1e53c510905040938q25d787f3w17f7a18f65bd0410@mail.gmail.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
Advanced Strings searches are Regex via re module.<br>
<br>
EX:<br>
<br>
import re<br>
<br>
m = re.compile(&quot;(FDA.*?(approved|supported)|Ben[^\s])*&quot;)<br>
<br>
if m.search(Text):<br>
    print m.search(Text).group()<br>
<br>
<br>
Vince<br>
<br>
<br>
On Mon, May 4, 2009 at 6:45 AM, Alex Feddor &lt;<a href="mailto:alex.feddor@gmail.com">alex.feddor@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Hi<br>
&gt;<br>
&gt; I am looking for method enables advanced text string search. Method<br>
&gt; string.find() or re module seems no  supporting what I am looking for. The<br>
&gt; idea is as follows:<br>
&gt;<br>
&gt; Text =&quot;FDA meeting was successful. New drug is approved for whole sale<br>
&gt; distribution!&quot;<br>
&gt;<br>
&gt; I would like to scan the text using AND and OR operators and gets -1 or<br>
&gt; other value if the searching elements haven&#39;t found in the text.<br>
&gt; Example 01:<br>
&gt; search criteria:  &quot;FDA&quot; AND ( &quot;approve*&quot; OR &quot;supported&quot;)<br>
&gt; The catch is that in Text variable FDA and approve words  are not one after<br>
&gt; another (other words are in between).<br>
&gt;  Example 02:<br>
&gt; search criteria: &quot;Ben&quot;<br>
&gt; The catch is that code sould find only exact Ben words not also words which<br>
&gt; that has firts three letters Ben such as Benquick, Benseek etc.. Only Ben is<br>
&gt; the right word we are looking for.<br>
&gt;<br>
&gt; I would really appreciated your advice - code sample / links how above can<br>
&gt; be achieved! if possible I would appreciated solution achieved with free of<br>
&gt; charge module.<br>
&gt;<br>
&gt; Cheers,  Alex<br>
&gt; PS:<br>
&gt; A few moths ago I have discovered Python. I am amazed what all can be done<br>
&gt; with it. Really cool programming language..<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
&gt; <a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
&gt;<br>
&gt;<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://mail.python.org/pipermail/tutor/attachments/20090504/88993fa6/attachment.htm" target="_blank">http://mail.python.org/pipermail/tutor/attachments/20090504/88993fa6/attachment.htm</a>&gt;<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
<br>
<br>
End of Tutor Digest, Vol 63, Issue 8<br>
************************************<br>
</blockquote></div><br>