Refactoring regex