changing regex pattern to be more robust