php – Regular Expression Schnipsel – Escaping “/”

closeThis post was published more than three months ago. Please note that the information offered here may no longer be current and valid. Therefore, please inform yourself about this topic elsewhere. If there is any new information, you can also send me a comment. Thank you so much!

Hier ein kleines Beispiel wie man die Lesbarkeit von RegEx durch den Delimiter  “#” verbessern kann … ;)

$zeichenkette = " Informationen / test, lall / Linux / lall123";
#$suchmuster = "/^[^\/]*\/[^\/]*\/[^\/]*\/[^\/]/";
$suchmuster = "#^[^/]*/[^/]*/[^/]*/[^/]#";
preg_match($suchmuster, $zeichenkette, $treffer);



Array ( [0] => Informationen / test, lall / Linux / )

Published by


Lars Moelleken | Ich bin root, ich darf das!

%d bloggers like this: