Given that this is going to be executed frequently, it's better if you provide a fixed REGEXP (stored privately?) and use that every time. Compiling every time the same regexp is inefficient.