Click to See Complete Forum and Search --> : regular expression problem


keerthi
07-15-2005, 07:44 AM
i am not very good in regular expression.so can anyone help me in this.or is there any other way to solve this problem.

i need to store all the contact information of a set of dealers in a database.so for this i need to parse through the dealers website(ie only the anchor tags) and select only those alt text having the phrase "contact" --but alt text may be contact,contact info,contact us,etc..

i parsed through the website using parse_links().now i have all the anchor tags with alt text but the thing i need to store only those links having contact information.but the alt text is different in different dealer websites.


this may look silly..but i need to find it ..

if it is in database i can give a query using LIKE..

i couldnt explain the scenario properly.its pretty tough and a big story.


help me as soon as possible.

i welcome any good suggession.

keats

keerthi
07-15-2005, 08:39 AM
hi

i need a regular expression for matching a word with a sentence.

like "contact" in a sentence which may contain contact,contactinfo,contact us etc.



keats

BeachSide
07-15-2005, 08:41 AM
preg_match('/contact/', $string)

keerthi
07-15-2005, 08:56 AM
thanxs

pyro
07-15-2005, 09:11 AM
If all you are doing is trying to determine if one string is found within another, use strpos (http://us2.php.net/manual/en/function.strpos.php), as it will be faster.