python3 regex?

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Fri Sep 9 23:41:22 EDT 2016


On Saturday, September 10, 2016 at 3:12:17 PM UTC+12, Doug OLeary wrote:
> $ perl -ne 'print if (m{^("?)[1-9]*\.})' tables

Perl has this feature of being able to use alternate delimiter symbols for the pattern; Python does not.

> >>> regex = r'^("?)[1-9]*\.'

Try putting a backslash in front of the “"”:

    regex = r'^(\"?)[1-9]*\.'



More information about the Python-list mailing list