I would like to find http:// oder https:// in a string and if one of the two is matched, return rest of string.
Examples:
http://www.devnetwork.net => http://www.devnetwork.net
https://www.devnetwork.net => http://www.devnetwork.net
Finding the patterns ist not the problem. But how can I return the rest of the string, if there ist a match. I guess backreferences is the solution, but I'm a newbie in backreferences...
Code: Select all
if (preg_match('/(http|https):\/\//', $row->url)) {
}
else {
}Thanks for your help!