refactored regex a bit