I am new to PHP regex, and I read the http://php.net/manual/en/function.preg-match.php. but can’t find the way to fix my bug.
Could you please give me a hand?
Thanks.
<?php
$myURL = "/something/";
// If myURL include two or more than two '/' then return Found, Else return Not found two '/'
if (preg_match("/\/?\//", $myURL)) {
echo "found";
} else {
echo "not found";
}
?>
1 Answer