refactored regex string builder