Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98716

Is it useful for re.M in this example?

Newsgroups comp.lang.python
Date 2015-11-12 13:34 -0800
Message-ID <fc8a4061-5156-41c8-bfd7-d9a8da462418@googlegroups.com> (permalink)
Subject Is it useful for re.M in this example?
From fl <rxjwg98@gmail.com>

Show all headers | View raw


Hi,

I follow a web site on learning Python re. I have read the function
 description of re.m, as below.


re.M	Makes $ match the end of a line (not just the end of the string) and
 makes ^ match the start of any line (not just the start of the string).

But I don't see the reason to put re.M in the example project:



#!/usr/bin/python
import re

line = "Cats are smarter than dogs";

matchObj = re.match( r'dogs', line, re.M|re.I)
if matchObj:
   print "match --> matchObj.group() : ", matchObj.group()
else:
   print "No match!!"


The tutorial (http://www.tutorialspoint.com/python/python_reg_expressions.htm)
is for a beginner as I. Is there something I don't see in the example?

Thanks,

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Is it useful for re.M in this example? fl <rxjwg98@gmail.com> - 2015-11-12 13:34 -0800
  Re: Is it useful for re.M in this example? John Gordon <gordon@panix.com> - 2015-11-12 22:00 +0000
  Re: Is it useful for re.M in this example? Terry Reedy <tjreedy@udel.edu> - 2015-11-12 22:32 -0500

csiph-web