[Tutor] Checking telephone numbers: re or strings

Charlie Clark charlie@begeistert.org
Fri Jan 31 05:36:03 2003


On 2003-01-31 at 11:05:14 [+0100], Danny Yoo wrote:
> Ok, the last one didn't work out because the regular expression didn't=20
> match against '001745648324', but that's a situation we can properly=20
> detect, if we write a little more code.
>=20
>=20
> I think this approach --- compiling a regular expression at runtime ---=20
> should still be pretty darn fast, since we avoid doing loops over=20
> individual regular expressions.
>=20
> There are other techniques we can use to make this go even faster, but=20
> let's see how far the standard regular expressions can take us.

So I've done the tests:
string based solution =3D 3.94 secs
regex based solution =3D 2.84 secs

Thanx Danny!

Charlie
--=20
Charlie Clark
Helmholtzstr. 20
D=FCsseldorf
D- 40215
Tel: +49-211-938-5360