hallo zusammen !
habe hier ein problem:
txt datei lese ich zeilenweise aus und will dann
die zeilen nach dem vorkommen eines bestimmten wortes durchsuchen
klappt auch bedingt gut - leider nur wenn als suchbegriff einzelne buchstaben verwendet werden ("S") oder ("t")
ab zwei zeichen tut die kiste so als wär nix drin ...
ht jemand ne idee woran das liegen kann bzw. wie das zu ändern ist ??
script auszug:
$file = file("$datei");
start parse
$linecount = 0;
while ($linecount <= $linemax) {
$line = $file[$linecount];
## start scan
$scan_count = 0;
while ($scan_count <= $scanmax){
echo "$linecount:";
echo strpos($line,$scanfor["$scan_count"]);
echo "<br>";
$result = strstr($line,$scanfor["$scan_count"]);
if (empty($result) != 1) {
$start = strpos($line,"\t");
$end = strpos($line,"\n");
$lenght = $end - $start; $result = substr("$line",$start,$lenght); $result = trim("$result");
echo "<tr height=40><td><b>";
echo $scanfor["$scan_count"];
echo ": </b></td><td>";
echo "$result";
echo "</td></tr>";
$result_count = $result_count + 1;
unset($result);
}
$scan_count = $scan_count + 1;
}
$linecount = $linecount + 1;
}
end parse
ps: wenn ich $line ausgebe sieht's eigentlich gut aus -
und regex statt strstr hab ich auch schon vesucht
vielen dank für eure hilfe
gruss
max