Regular expressions
rurpy at yahoo.com
rurpy at yahoo.com
Mon Nov 2 23:23:48 EST 2015
On Monday, November 2, 2015 at 8:58:45 PM UTC-7, Joel Goldstick wrote:
> 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.
Regular expressions should be learned by every programmer or by anyone
who wants to use computers as a tool. They are a fundamental part of
computer science and are used in all sorts of matching and searching
from compilers down to your work-a-day text editor.
Not knowing how to use them is like an auto mechanic not knowing how to
use a socket wrench.
More information about the Python-list
mailing list