I\'m looking to replace all instances of spaces in urls with %20. How would I do that with regex?
Thank you!
$result = preg_replace('/ /', '%20', 'your string here');
you may also consider using
$result = urlencode($yourstring)
to escape other special characters as well