99921-58-10-7
9971-5-0210-0
960-425-059-0
80-902734-1-6
85-359-0277-5
1-84356-028-3
0-684-84328-5
0-8044-2957-X
0-85131-041-9
0-943396-04-2
0-9752298-0-X
examples/regex/isbn.py
from __future__ import print_function
import re

strings = [
    '99921-58-10-7',
    '9971-5-0210-0',
    '960-425-059-0',
    '80-902734-1-6',
    '85-359-0277-5',
    '1-84356-028-3',
    '0-684-84328-5',
    '0-8044-2957-X',
    '0-85131-041-9',
    '0-943396-04-2',
    '0-9752298-0-X',

    '0-975229-1-X',
    '0-9752298-10-X',
    '0-9752298-0-Y',
    '910975229-0-X',
]
for s in strings:
    print(s)
    if (re.search(r'^[\dX-]{13}$', s)):
        print("match 1")
    if (re.search(r'^\d{1,5}-\d{1,7}-\d{1,5}-[\dX]$', s) and len(s) == 13):
        print("match 2")