How can we extract string 'abc.com' from a string
"http://info@abc.com" using regular expression of PHP

Answer Posted / rachana

We can use the preg_match() function with "/.*@(.*)$/" as
the regular expression pattern. For example:
preg_match("/.*@(.*)$/","http://info@abc.com",$data);
echo $data[1];

Is This Answer Correct ?    49 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to redirect a url from http to https in .htaccess?

523


How error handling is being handled by php?

550


What is asort php?

536


How to remove leading and trailing spaces from user input values?

544


How to download and install php on windows?

606






What are the features of php?

556


What is the Default syntax used in PHP?

598


What is echo in html?

501


What are the differences between php constants and variables?

511


What is list function with their uses.

533


What is in php 7?

559


How do I escape data before storing it in the database?

574


What is faster in php?

582


What are psrs?

603


Which php framework is fastest?

508