Core Python Programming (2nd Edition)

1.

Matching strings

bat, hat, bit, etc.

[bh][aiu]t

2.

First name last

[A-Za-z-]+ [A-Za-z-]+

(Any pair of words separated by a single space, e.g., first and last names, hyphens allowed)

3.

Last name first

[A-Za-z-]+, [A-Za-z]

(Any word and single letter separated by a comma and single space, e.g., last name, first initial)

[A-Za-z-]+, [A-Za-z-]+

(Any pair of words separated by a comma and single space, e.g., last, first names, hyphens allowed)

8.

Python longs

\d+[lL]

(Decimal [base 10] integers only)

9.

Python floats

[0-9]+(\.[0-9]*)?

(Describes a simple floating point number, that is, any number of digits followed optionally by a single decimal point and zero or more numeric digits, as in "0.004," "2," "75.," etc.)

Категории