xref: /netbsd-src/external/bsd/tre/dist/python/example.py (revision 63d4abf06d37aace2f9e41a494102a64fe3abddb)
1*63d4abf0Sagcimport tre
2*63d4abf0Sagc
3*63d4abf0Sagcfz = tre.Fuzzyness(maxerr = 3)
4*63d4abf0Sagcprint fz
5*63d4abf0Sagc
6*63d4abf0Sagcpt = tre.compile("Don(ald( Ervin)?)? Knuth", tre.EXTENDED)
7*63d4abf0Sagcdata = """
8*63d4abf0SagcIn addition to fundamental contributions in several branches of
9*63d4abf0Sagctheoretical computer science, Donnald Erwin Kuth is the creator of the
10*63d4abf0SagcTeX computer typesetting system, the related METAFONT font definition
11*63d4abf0Sagclanguage and rendering system, and the Computer Modern family of
12*63d4abf0Sagctypefaces.
13*63d4abf0Sagc
14*63d4abf0Sagc"""
15*63d4abf0Sagc
16*63d4abf0Sagcm = pt.search(data, fz)
17*63d4abf0Sagc
18*63d4abf0Sagcif m:
19*63d4abf0Sagc    print m.groups()
20*63d4abf0Sagc    print m[0]
21