Regular expressions

Seymore4Head Seymore4Head at Hotmail.invalid
Tue Nov 3 11:10:20 EST 2015


On Tue, 3 Nov 2015 10:34:12 -0500, Joel Goldstick
<joel.goldstick at gmail.com> 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.
>>
>
>Are we to infer that you were aware of doing the   if line[-1] == '*': ...
>, but just wanted to learn how to do the same thing with regex? Or that you
>heard about regexes and thought that would be the way to solve your puzzle?
>
>> Thanks
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
Yes I knew that -1 represents the end character.  It is not a question
of trying to accomplish anything.  I was just practicing with regex
and wasn't sure how to express a * since it was one of the
instructions.




More information about the Python-list mailing list