used $~ instead of match() to obtain the captures

See #8