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

Explain Constant in Class?

794


Is php faster than nodejs?

705


can you give me an example code of calling java script function in php variable using AJAX.or with out ajax??????

1589


What is php and how do you use it?

747


Is overloading possible in php?

722


Do you know how to enable error reporting in php?

705


How to find a specific value in an array?

691


Which operator is used to concatenate two strings in PHP?

786


Write the statements that are used to connect php with mysql

750


Tell me what are sql injections, how do you prevent them and what are the best practices?

724


What is whitespace in php?

775


What does $_server mean?

756


CWD is a type of shell variable. State Whether True or False?

827


What is the use of htmlentities in php?

706


How does csrf attack work?

763