Reduced complexity of regex