How can we extract string ?allinterview.com ? from a string
?http://info@allinterview.com? using regular expression of PHP?

Answers were Sorted based on User's Feedback



How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using re..

Answer / pinky

if (ereg("allinterview.com",
"http://info@allinterview.com", $temp) )

print $temp[0];

Is This Answer Correct ?    4 Yes 1 No

How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using re..

Answer / vipul dalwala

$string = "http://info@allinterview.com";
preg_match(@^(?:http://)?([^@]+)(.*)$@i', $string,
$matches);

print $matches[2]; // allinterview.com

Is This Answer Correct ?    3 Yes 2 No

How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using re..

Answer / raj

$text = "http://info@allinterview.com";
preg_match('|.*@([^?]*)|', $text, $output);
echo $output[1];

Is This Answer Correct ?    1 Yes 0 No

How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using re..

Answer / kichu

Using explode function

Is This Answer Correct ?    1 Yes 4 No

How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using re..

Answer / jcb.chl

<?
$str = substr('http://info@allinterview.com?',12);
echo $str;
?>

output:

allinterview.com?

Is This Answer Correct ?    2 Yes 6 No

How can we extract string ?allinterview.com ? from a string ?http://info@allinterview.com? using re..

Answer / iiiiiiii

iiiiiiii

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More PHP Interview Questions

Why is overriding runtime?

0 Answers  


Tell us how can we access the data sent through the url with the post method?

0 Answers  


Are static variables final?

0 Answers  


What are the Advantages and Application Areas of PHP?

0 Answers  


What are the differences between GET and POST methods?

0 Answers  






What is array filter php?

0 Answers  


What does session start do in php?

0 Answers  


How can I make a script that can be bilanguage (supports English, German)?

3 Answers  


What is the difference between Reply-to and Return-path in the headers of a mail function?

2 Answers  


What are the rules to declare a php variables?

0 Answers  


Is salary a ratio or interval?

0 Answers  


Is uploaded file php?

0 Answers  


Categories