matching regular expressions with string

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
User avatar
crystal ship
Forum Commoner
Posts: 36
Joined: Wed Aug 29, 2007 5:45 am

matching regular expressions with string

Post by crystal ship »

I have used
preg_match("/$target/i", $file);
which returns many unwanted files
such as
if i am searching for file name test1.php it also returns test2.php.
so I tried to use preg_match_all like
preg_match_all("/$target/i", $file);
which returns nothing

What is wrong in this? In need of suggestions.

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

impossible to answer without seeing the pattern and data you are pushing against it, and a better idea of what you want out of it.
User avatar
crystal ship
Forum Commoner
Posts: 36
Joined: Wed Aug 29, 2007 5:45 am

Post by crystal ship »

Thank You
But I have solved the problem by using strcmp()
Post Reply