REGEX help

what does
[size=24pt]:? [/size]
would mean in a regex
[php]preg_match("/(:?get_comments|delete_comment|add_comment|).php$/", $_SERVER[“PHP_SELF”]))[/php]

It’s basically saying to look for the following string (the | characters separate multiple options) - so this would match get_comments.php delete_comment.php and add_comment.php

That i know …but my question is why would someone like to match colon: filename.php instead of only doin filename.php match

I honestly can’t say (useful I know). It seems there is more to this than meets the eye, however. For example, I have included a link to a page below that covers some regex info - the line above the first code example mentions the use of this syntax slightly. A bit more digging and you may well find yourself an answer, but it could simply be like using echo or print in PHP - no major difference, just personal taste.

http://us3.php.net/manual/en/regexp.reference.subpatterns.php

Sponsor our Newsletter | Privacy Policy | Terms of Service