updated regex to handle leading/trailing non word characters