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 |
What is isset php?
Explain the syntax for ‘foreach’ loop with example.
What is meant by content management system?
3 Answers Global Logic, IBEE, TCS, Toyota,
How to swap two variables without using 3rd temp variable.
List out some tools through which we can draw E-R diagrams for mysql?
What is the php function that removes the first element of the array and returns it?
How to redirect https to http url and vice versa in .htaccess?
What is urlencode and urldecode in php?
How to open a file for reading?
How can we submit a form without using submit buttons?
What is zend studio for?
How can you insert javascript in php code?