Da fehlt was!
![Big Grin](https://www.php-resource.de/forum/core/images/smilies/biggrin.gif)
$txt = "Natürlich, aber weshalb ist alles nicht da?";
preg_match('=\\s([a-z]{5})\\s=i', $txt, $found);
echo "$found[1]<br />";
$txt = "testeintrag von amind, sowie ein eintrag von kuchb und dann nochmal ein bischen bla bla...";
preg_match('=\s([a-z]{5})\s=i', $txt, $found);
echo "$found[1]<br />";
$txt = "testeintrag von amind, sowie ein eintrag von kuchb und dann nochmal ein bischen bla bla...";
preg_match('=\svon?\s([a-z]{5})\sund?\s=i', $txt, $found);
print_r($found);
preg_match('=\svon?|mit?\s([a-z]{5})\sund?|ohne?\s=i', $txt, $found);
$lognotes= "*** CANDY Initial Case Notes 30.05.2008 14:53:01TESTTICKET FÜR
CANDY N: Further investigation C: xxxx *** CANDY LOG 30.05.2008 15:11:01 by
user \"amind\": Change Severity to C/D-Kunde; Anz. Kundenbeschw. to 1; CANDY
URL; [schruefg]sa ende gesetzt *** CANDY LOG 30.05.2008 15:11:01 by user
\"CANDY\": Change Severity to C/D-Kunde; Anz. Kundenbeschw. to 1; CANDY
URL; [schruefg]sa ende gesetzt *** CANDY LOG 30.05.2008 15:11:01 by user
\"CANDY\": Change Severity to C/D-Kunde; Anz. Kundenbeschw. to 1; CANDY
URL; [schruefg]sa ende gesetzt *** NOTES 30.05.2008 15:30:18 schruefg Action
Type: Operator Wiedervorlage-Datum:31.05.2008 05:00:00 testicket *** STATUS
CHANGE 30.05.2008 15:30:18 by user \"schruefg\" from status \"Offen\" to status
\"Wartend\" Grund: Wiedervorlage [schruefg]test04.06.2008 09:23:01 by user
\"CANDY\": Change Severity to C/D-Kunde; Anz. Kundenbeschw. to 1; CANDY
URL; *** NOTES 02.07.2008 10:00:11 CANDY Action Type: Operator Bitte um ein
Update des aktuellen Bearbeitungsstandes. *** NOTES 02.07.2008 11:31:12 kuchb
Action Type: Operator Bitte um ein Update des aktuellen Bearbeitungsstandes.";
preg_match('=\s(user?)\s([a-z]{5,9})\s(Action?)\s(from?)\s=i', $lognotes, $shortys);
print_r($shortys);
preg_match_all('=\s(by user)?\s(\")?([a-z]{5,9})(\")?\s(Action|from)?\s=i', $lognotes, $shortys);
//Such die Fälle durch die vorkommen können um das aktuelle Kürzel zu bekommen.
preg_match_all('=[0-9]{2}.[0-9]{2}.[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}\sby user "(.[^"]*)=i', $
lognotes, $shortys1, PREG_OFFSET_CAPTURE);
preg_match_all('=\*\*\*\sNOTES\s[0-9]{2}.[0-9]{2}.[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}\s([^b^\s][^y^\s][^\s]*)[\s]=i',
$lognotes, $shortys2, PREG_OFFSET_CAPTURE);
//Array verbinden, damit nach dem letzten Kürzel, gesucht werden kann.
$arr = array_merge($shortys1[1], $shortys2[1]);
//Ist das grösste Kürzel in $shortys1 oder in $shortys2
if($shortys1[1][count($shortys1[1])-1][1]>$shortys2[1][count($shortys2[1])-1][1]) {
//Ist das grösste hier?
$kuerzel=$shortys1[1][count($shortys1[1])-1][0];
} else {
//oder ist es hier?
$kuerzel=$shortys2[1][count($shortys2[1])-1][0];
}
Kommentar