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 is it possible to return a value from a function?

530


Which programming language does php resemble?

529


Tell me how can we pass the variable through the navigation between the pages?

517


What are the differences between session and cookie?

516


What is session in php w3schools?

546






How to randomly retrieve a value from an array?

544


How can I make a script that can be bilingual (supports english, german)?

579


How variables are passed through arguments?

548


What is apache and php?

486


What is the difference between html and php?

537


What does type casting mean in php? Explain with an example?

537


Does strlen include null?

570


How do you check is php not empty?

543


What is php glob?

561


Explain how can php and javascript interact?

534