updated the SplitStringBy function to split by regex