I'm looking to replace all instances of spaces in urls with %20. How would I do that with regex?
Thank you!
No need for a regex here, if you just want to replace a piece of string by another: using str_replace()
should be more than enough :
$new = str_replace(' ', '%20', $your_string);