I wrote a simple object-oriented solution whereby special callout classes (ie: mentions, emoticons, links, future features) directly inherited from an abstract class that provided business logic functionality common to all callouts. The actual parsing code was broken up into smaller modules. By coding these classes to an interface, I was able to decouple the business logic from the parsing code. I employed the strategy pattern to meld everything together. As such, this approach is easily extendable to new functionality.