Pattern parser (refactor)

Creating objects to make the algorithm more efficient. I also decided
that the pattern must be determined the easy way: ie abc|abd must be
replaced with ab(c|d)