fixed stripping characters function with regex