Use substr instead of regex