Punct Character Class
What is [[:punct:]]?
Explanation
This character class identifies all the punctuation characters.
PHP Example:
<?php
$punct = 'X@^#@#X';
$det = ereg_replace("[[:punct:]]","Y",$punct);
echo $det;
?>
Result :
XYYYYYX
In the above example it is used with "^" like "[^[", so it behaves like "NOT"
so the pattern check for character other than punctuation characters,since used with a "!" before "!ereg" again its specifies "NOT",
so it matches punctuation marks and it returns "Match".
Perl Example:
#! C:\programfiles\perl\bin\perl
print "content-type: text/html\n\n";
$str = "sfgjhsdgf@";
if ( $str =~ /[[:punct:]]$/)
{print "Matches!";}
else
{print "Unmatch!";}
Result :
Matches!