improving the performance of regexp and strstr