regex - Convert spaces of all sizes to a standard space in PHP? -
was wondering if there clean way replace space character variants (half space, full-width space, chinese space, etc.) standard space?
bonus points replacing multiple spaces in row (like 3 half-width or zero-width spaces or of each) single normal space.
i'll go obvious regular expression.
preg_replace('~\s+~u', ' ', 'your input here');
Comments
Post a Comment