How can we extract string ?allinterview.com ? from a string
?http://info@allinterview.com? using regular expression of PHP?

Answer Posted / vipul dalwala

$string = "http://info@allinterview.com";
preg_match(@^(?:http://)?([^@]+)(.*)$@i', $string,
$matches);

print $matches[2]; // allinterview.com

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what is the default session time in php?

735


A process is identified by a unique___

777


Write a program to find no of days between two dates in php?

704


Tell me what library is used for pdf in php?

708


What exactly is PHP?

778


What is the meaning of a final class and a final method?

755


What is the use of php and mysql?

729


Is empty array php?

722


Does php support overloading?

765


How to calculate the difference between two dates using php?

732


What is php form validation?

740


Tell me what is the main difference between require() and require_once()?

722


What are php libraries?

694


What is cookie and why do we use it?

720


What is the difference between Split and Explode in PHP?

779