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

How to print \ in php. Only \ with out using . or *.

7 Answers   American Solutions,


How to execute an sql query? How to fetch its result?

0 Answers  


A process can run only in the background. State Whether True or False?

0 Answers  


What are php parameters?

0 Answers  


Explain PHP looping?

0 Answers  






When should you use a stored procedure?

0 Answers  


Want to know the 10th max salary in salary table

3 Answers  


Tell me what is htaccess? Why do we use this and where?

0 Answers  


What php framework does wordpress use?

0 Answers  


How can we submit a form without a submit buttom?

12 Answers   A1 Technology, IBM,


How do I end a php session?

0 Answers  


What is php7?

0 Answers  


Categories