Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can we extract string 'abc.com' from a string
"http://info@abc.com" using regular expression of PHP

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I escape data before storing it into the database?

968


what is mean by portal

2025


How to get number of elements in an array?

988


What is the delimiter syntax is PHP's default delimiter syntax

1255


What is a collection in php?

942


Which function is used in php to search a particular value in an array?

896


Do while loops?

953


What are the main error types in php?

1073


What is x+ mode in fopen() used for?

1012


What are differences between PECL and PEAR?

1047


What is the purpose of the '.frm' file extension? What do thes file contain?

961


How to execute an sql query? How to fetch its result?

1105


What is strlen function in php?

1014


Explain me what are the 3 scope levels available in php and how would you define them?

1196


What is meant by an associative array?

990