Regular Expression AND mach

Josiah Carlson jcarlson at
Sat Mar 20 01:02:38 CET 2004

> PS If you liked these regular expressions and would like to buy more,
> visit e-bay where I'm selling a RE that matches multiples of 3 base 10.

An exercise given by an undergraduate professor for a theory of 
computation course (my friend was the TA) was as follows...

Given a binary string ab that is the alternation of elements of binary 
string a and binary string b, that is (in set notation)...
a = {a1, a2, a3,...,an}
b = {b1, b2, b3,...,bn}
ab = {a1, b1, a2, b2,..., an, bn}

Create a regular expression to determine if string a (taken as a binary 
integer) is exactly 3 times string b (also taken as a binary integer).

Strangely enough, it is actually possible.  I'll leave it as an exercise 
to the reader.

  - Josiah

More information about the Python-list mailing list