Forum Moderators: coopster
I have a problem where I need to clean up user submitted addresses.
The issue is not everyone is putting a 'space' behind their commas.
example:
12345 ABC Street,Midland,TX,79708,USA
needs to be:
12345 ABC Street, Midland, TX, 79708, USA
I need to be able to insert a space after each comma.
Sometimes the spaces might be there, sometimes not.
I know I'll need to use the Regex String Replace function, I just do not know how to do this with regex.
Could anyone help out?
Thanks,
James
preg_replace('/,\s?/', ', ', $string); should work.
$pattern = "/,\s*/";
Anyway, glad it worked out. :)