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

Answers were Sorted based on User's Feedback



How can we extract string ‘abc.com ‘ from a string info@abc.com" target="_blank"..

Answer / simlu_irtt

$string1="info@abc.com";
$string2=split("@",$string1);
print_r($string2);

this code print the string as abc.com

Is This Answer Correct ?    23 Yes 6 No

How can we extract string ‘abc.com ‘ from a string info@abc.com" target="_blank"..

Answer / simlu_irtt

$string1="info@abc.com";
$string2=split("@",$string1);
print_r($string2);

this code print the string as abc.com

Is This Answer Correct ?    6 Yes 2 No

How can we extract string ‘abc.com ‘ from a string info@abc.com" target="_blank"..

Answer / ankush prasad

<?php
$string1="info@abc.com";
$string2=preg_match("/[a-c]+.[c-o]+/",$string1,$a);
print $a[0];
?>

Is This Answer Correct ?    2 Yes 0 No

How can we extract string ‘abc.com ‘ from a string info@abc.com" target="_blank"..

Answer / harsh

$string1="info@abc.com";
$string2=split("@",$string1);
print_r($string2);

Is This Answer Correct ?    2 Yes 2 No

How can we extract string ‘abc.com ‘ from a string info@abc.com" target="_blank"..

Answer / supriya

$str1="info@abc.com";
$str1=explode("@",$str1);
print_r($str1);

Is This Answer Correct ?    2 Yes 2 No

How can we extract string ‘abc.com ‘ from a string info@abc.com" target="_blank"..

Answer / 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

More PHP Interview Questions

What is the difference between get and post in php?

0 Answers  


What is difference between require_once(), require(), include()?

0 Answers  


What is the difference between mysql_connect and mysql_pconnect ? Which one is good in terms of performance ?

4 Answers  


how we can retrive data in pdf along php mysql?

2 Answers  


Which of the data type is compound datatype supported by PHP?

0 Answers  






What is cookies? How to create cookies in php?

0 Answers  


how to overcome server time behind twleve hours compare to local system time

0 Answers  


Can I use php in html?

0 Answers  


What is php and its features?

0 Answers  


Is variable name casesensitive in php?

0 Answers  


How to retrieve values out of an array?

0 Answers  


What is a controller php?

0 Answers  


Categories