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 are the current versions of apache, PHP, and mysql?
How can we upload a file in php?
How do you end a session in php?
Is not null mysql?
hi, i have knowledge about PHP/MYSQL,i am fresher M.Sc-IT 2009 pass out,any recruitment in PHP please let me know.
How does integrate SSL certificate in websites and also how to generate CSR in Local machines? plese give some ideas ASAP.....
How to register a variable in PHP session?
What is a trait in php?
What does the unlink() function mean?
Which variable declarations within a class is invalid in php?
does current version of mysql (myisam) supports foreign keys ?
What is the difference between explode() and split() functions?