refactored new function with regex, now tabs included