improved parsing performance

Implement faster parsing and theoretically reduce memory overhead to handle larger data sets by avoiding use of preg_* functions when not necessary.