update regex to capture only spaces before function