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
Answer / pinky
if (ereg("allinterview.com",
"http://info@allinterview.com", $temp) )
print $temp[0];
| Is This Answer Correct ? | 4 Yes | 1 No |
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 |
Answer / raj
$text = "http://info@allinterview.com";
preg_match('|.*@([^?]*)|', $text, $output);
echo $output[1];
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / jcb.chl
<?
$str = substr('http://info@allinterview.com?',12);
echo $str;
?>
output:
allinterview.com?
| Is This Answer Correct ? | 2 Yes | 6 No |
How many ways we can pass the variable through the navigation between the pages?
which function used to get the number of days between two given dates in php
Why is facebook still using php?
What is global variable php?
Explain what does the function get_magic_quotes_gpc() means?
What are the disadvantages of php?
Write a program to find no of days between two dates in php?
Explain the casts allowed in PHP?
Where is php code written?
What is a static variable in php?
How to download a php script directly in your script page?
3 Answers A1 Technology, Zmanda,
Which is better php praogramming or cad/cam scope wise and also salaray wise?