php preg_match string pattern help.
Tim C Bruhn
tim at granths.sa.edu.au
Wed Nov 15 01:13:15 CST 2006
Hi, I am trying to write a little bit of PHP and i've run into some
problems.
I have an array with, say two different types of strings, some contain
'$' and the others do not. i would like to separate the two and print
the ones containing '$' and forget about the others.
example of strings:
'\\10.60.40.214 CO3-23$ Windows 2000 2195 0 00:00:08' <----- this is the
one i would like to print
'\\10.60.41.108 MONIQUM Windows 2000 2195 3 00:00:00' <-----this is the
one that i would like to leave alone
so far i have come up with this:
$pattern = ?????noidea?????
foreach($array as $row)
{
if (preg_match($pattern, $row))
{
echo "A match was found.".$row;
} else {
echo "A match was not found.";
}
}
the only problem is that i have no idea what the string pattern has to
look like to search/match a single dollar sign in the middle of a
string. Any idea would be greatly appreciated.
thanks tim.
--
Tim C Bruhn
the insignificant trainee
Grant High School
More information about the linuxsa
mailing list