What language are you using? This is fairly trivial using perl:
perl -e'while(<>){@m=/(\w+)\s*=\s*(\w+)/g;print "@m\n"}'
It gets a bit trickier (but not a whole lot) if you want to allow more than word characters (alphanumerics and underscore) as your a and b:
@m=/\s*([^&=]+?)\s*=\s*([^&]+)/g
And, if you're sure you'll always get pairs, then you can assign that to a hash, as well, so you automatically have key => value pairs.
edit: Note... the while() is just looping over stdin, so you can input your test cases, not looping your regex over the input. That part is taken care of by the /g modifier.