Human word reader

Xavier Ho contact at xavierho.com
Sat May 15 08:38:01 EDT 2010


On Sat, May 15, 2010 at 9:32 PM, timo verbeek <timoverbeek10 at gmail.com>wrote:

> On May 15, 1:02 pm, timo verbeek <timoverbee... at gmail.com> wrote:
> Place starts always with for
>

Okay, much better.

Given that constraint, it looks like regular expression can do the job. I'm
not very experienced with regex, though.

\w* matches a whole word composed of letters and numbers by default.

>>> result = re.search('for \w*', 'Give me the weather for London please.')
>>> result.group()
'for London'
>>> result.group().split()[1]
'London'

Cheers,
Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100515/8d498273/attachment-0001.html>


More information about the Python-list mailing list