could this RegExp be a variable declared on outer scope instead of instantiating it every time?