more elegant way to implement regexp-like quantifiers,"['x', ' ', 'y', 'y', ' ', 'z']"