Find http:// oder https:// and return rest of string
Posted: Tue Aug 23, 2005 4:29 am
Hello together,
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...
Thanks for your help!
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!