Maybe I'm wrong but I thought that performing a Regular Expression on a very long string (file content there) was taking much more time than a subset. If that's not the case, I'll definitely go with your solution.