Why did Quora choose Python for its development?
Carl Banks
pavlovevidence at gmail.com
Sat May 28 01:32:03 EDT 2011
On Friday, May 27, 2011 6:47:21 AM UTC-7, Roy Smith wrote:
> In article <948l8n... at mid.individual.net>,
> Gregory Ewing <greg.... at canterbury.ac.nz> wrote:
>
> > John Bokma wrote:
> >
> > > A Perl programmer will call this line noise:
> > >
> > > double_word_re = re.compile(r"\b(?P<word>\w+)\s+(?P=word)(?!\w)",
> > > re.IGNORECASE)
>
> One of the truly awesome things about the Python re library is that it
> lets you write complex regexes like this:
>
> pattern = r"""\b # beginning of line
> (?P<word>\w+) # a word
> \s+ # some whitespace
> (?P=word)(?!\w) # the same word again
> """
> double_word_re = re.compile(pattern, re.I | re.X)
Perl has the X flag as well, in fact I'm pretty sure Perl originated it. Just saying.
Carl Banks
More information about the Python-list
mailing list