Robin> my own stupidity the patter should be Robin> re.compile(r'^self\s*\.\s*test\s*=\s*\d+\s*$').match('self.test=11') Also, if you're using the match method there's no need to include "^" at the start. (Are there siutations where it makes a difference?) -- Skip Montanaro (skip at pobox.com - http://www.mojam.com/)