in reply to Re: Regex operation optimisation
in thread Regex operation optimisation

I think that ? means {0,1}. Possibly + would be more appropriate.

Also, if you wish to eliminate all whitespace characters, which includes newlines, tabs, etc., then \s+ might be the way to go.