This is elegant code  but wouldn't be easier and more performant to just check to see if the characters before & after tagInfo.position.offset are spaces and return between class names?