There's no point trying to optimize your code if you're not sure what your data looks like. However index will be faster than a regex if you're only looking for a fixed string.
As other people have recommended, profile your code and find out where the time is going.
In reply to Re^3: How to optimize a regex on a large file read line by line ?
by RichardK
in thread How to optimize a regex on a large file read line by line ?
by John FENDER
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |