Page 1 of 1

How to find a word from a string?

Posted: Fri Sep 17, 2004 12:53 pm
by myleow
If i have a

Code: Select all

string  A = "./Contacts";
AND

Code: Select all

string B = "./C\System\Data\Contacts.dba";
is there a way to find if the word "Contacts" exist in these two strings?

Posted: Fri Sep 17, 2004 12:55 pm
by feyd

Code: Select all

preg_match('#\bContacts\b#',$string);