How can we extract string ‘abc.com ‘ from a string
info@abc.com" target="_blank">http://info@abc.com using
regular expression of php?
Answers were Sorted based on User's Feedback
Answer / simlu_irtt
$string1="info@abc.com";
$string2=split("@",$string1);
print_r($string2);
this code print the string as abc.com
Is This Answer Correct ? | 23 Yes | 6 No |
Answer / simlu_irtt
$string1="info@abc.com";
$string2=split("@",$string1);
print_r($string2);
this code print the string as abc.com
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / ankush prasad
<?php
$string1="info@abc.com";
$string2=preg_match("/[a-c]+.[c-o]+/",$string1,$a);
print $a[0];
?>
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / harsh
$string1="info@abc.com";
$string2=split("@",$string1);
print_r($string2);
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / supriya
$str1="info@abc.com";
$str1=explode("@",$str1);
print_r($str1);
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / rajan vardawaj
We can use the preg_match() function with “/.*@(.*)$/” as
the regular expression pattern. For example:
preg_match(”/.*@(.*)$/”,”info@abc.com”,$data"
target="_blank">http://info@abc.com”,$data); echo $data[1];
Is This Answer Correct ? | 2 Yes | 3 No |
Explain what are psrs? Choose 1 and briefly describe it?
What is csrf verification?
What is a null coalescing operator in php7?
What is the correct syntax of mail() function in php?
what is constructor in a class, how it is work, how it is call?
List the different types of print functions available in php?
What is the difference between rest and soap?
What the difference between the 'bitwise and' operator and the 'logical and' operator?
What does a delimiter do in mysql?
What is strcmp () in php?
Which is correct about mysqli and pdo?
What is an array in php?