How can we extract string ‘abc.com ‘ from a string
info@abc.com" target="_blank">http://info@abc.com using
regular expression of php?

Answer Posted / rajan vardawaj

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

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of stored procedures in php?

499


What is the difference between runtime exception and compile time exception?

547


What is cms php?

508


Explain me what is the use of header() function in php?

623


How to run a php script?

576






How can image properties be retrieved in php?

543


Is php 7.0 stable?

513


How to access standard error stream in PHP?

589


Is age interval or ordinal data?

531


Write a program in php to find the occurrence of a word in a string?

629


Is php a web server?

544


What is php compared to html?

543


Tell me is it possible to submit a form with a dedicated button?

533


What is the use of addslashes in php?

528


Is multiple inheritance supported in php?

567