How can we extract string 'abc.com' from a string
"http://info@abc.com" using regular expression of PHP
Answers were Sorted based on User's Feedback
Answer / rachana
We can use the preg_match() function with "/.*@(.*)$/" as
the regular expression pattern. For example:
preg_match("/.*@(.*)$/","http://info@abc.com",$data);
echo $data[1];
| Is This Answer Correct ? | 49 Yes | 2 No |
Answer / sameer joshi
You can do like $site_array=explod("@","http://info@abc.com");
$site_addr=$sitr_array[1];
$site_addr will get the value as abc.com
| Is This Answer Correct ? | 13 Yes | 7 No |
Answer / gaurav
you can use array split
$site_arr=split("@", "http://info@abc.com");
$site_name=$site_arr[1];
$site_name will have the value abc.com.
| Is This Answer Correct ? | 10 Yes | 5 No |
Answer / sathya
Use this coding
$variablename="http://info@abc.com";
$u=explode("@",$variablename);
$u2=$u[1];
| Is This Answer Correct ? | 7 Yes | 4 No |
Answer / nitesh kumar
you can use explode funciton
echo $site_array=end(explode("@","http://info@abc.com"));
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / navneet singh
$url = "http://info@abc.com"
$domain = strstr($url,"@");
echo $domain
| Is This Answer Correct ? | 5 Yes | 7 No |
Difference between array_combine and array_merge?
Why do we create an instance of a class in php?
How to insert a line break in php string?
What are php magic quotes?
How do I get csrf token?
How to connect SMTP server in php. I want to edit that in mantiss bug tracking tool. If anyone worked on mantiss software or in php, please give answer . I need to modify that in mantiss software.
How can we extract string "pcds.co.in" from a string "https://info@pcds.co.in" using regular expression of php? More on reg can you explain
What is the meaning of a final class and a final method?
How can we determine whether a variable is set?
Give any ten basic functions in PHP?
What is php glob?
Write a program in php to check whether a number is prime or not?