Regular expressions

Joel Goldstick joel.goldstick at gmail.com
Mon Nov 2 22:58:22 EST 2015


On Mon, Nov 2, 2015 at 10:17 PM, Seymore4Head <Seymore4Head at hotmail.invalid>
wrote:

> On Mon, 2 Nov 2015 20:42:37 -0600, Tim Chase
> <python.list at tim.thechases.com> wrote:
>
> >On 2015-11-02 20:09, Seymore4Head wrote:
> >> How do I make a regular expression that returns true if the end of
> >> the line is an asterisk
> >
> >Why use a regular expression?
> >
> >  if line[-1] == '*':
> >    yep(line)
> >  else:
> >    nope(line)
> >
> >-tkc
> >
> >
> Because that is the part of Python I am trying to learn at the moment.
> Thanks
> --
> https://mail.python.org/mailman/listinfo/python-list
>

My completely unsolicited advice is that regular expressions shouldn't be
very high on the list of things to learn.  They are very useful, and very
tricky and prone many problems that can and should be learned to be
resolved with much simpler methods.  If you really want to learn regular
expressions, that's great but the problem you posed is not one for which
they are the best solution.  Remember simpler is better than complex.

-- 
Joel Goldstick
http://joelgoldstick.com/stats/birthdays



More information about the Python-list mailing list