Add trimming to inserted name and simplify regex.