regex multiple patterns in order

Neil Cerutti neilc at norwich.edu
Mon Jan 20 11:04:43 EST 2014


On 2014-01-20, Roy Smith <roy at panix.com> wrote:
> In article
> <mailman.5748.1390216721.18130.python-list at python.org>, Ben
> Finney <ben+python at benfinney.id.au> wrote:
>> Be aware that regex is not the solution to all parsing
>> problems; for many parsing problems it is an attractive but
>> inappropriate tool. You may need to construct a more specific
>> parser for your needs. Even if it's possible with regex, the
>> resulting pattern may be so complex that it's better to write
>> it out more explicitly.
>
> Oh, posh.
>
> You are correct; regex is not the solution to all parsing
> problems, but it is a powerful tool which people should be
> encouraged to learn.  For some problems, it is indeed the
> correct tool, and this seems like one of them.  Discouraging
> people from learning about regexes is an educational
> anti-pattern which I see distressingly often on this newsgroup.

I use regular expressions regularly, for example, when editing
text with gvim. But when I want to use them in Python I have to
contend with the re module. I've never become comfortable with
it.

-- 
Neil Cerutti




More information about the Python-list mailing list