Use non-synchronized class StringBuilder instead of StringBuffer
Make doTag() final, since it is a template method.
Add test documenting the behavior when multiple matches are found