Possible Duplicate:
How to add http:// if it’s not exists in the URL?
Say I want to match a URL that may have either http://
, https://
or neither in it. When I replace it, I want to have https://
at the front if it was there, but if it was http://
or nothing I want to have http://
at the beginning.
I can't figure out how to figure this out with a preg_match expression, or for the non-PHP inclined, a search and replace PHP function.