I have a string suppose “ABCDEF>(#*W” (could be any string)
I want a function character class, such that it returns a false value if any other character then “A-Z or a-z or 0-9 or @ or $ or [ or ] or ( or ) or . or _” exists in the string.
More explanation:
$string=“A.BC_@$09” //this should return true value, no invalid characters in it.
$string=“ABC DEF” //this should return false value (because it has space)
$string=“ABC_><” //this should return false value (because > and < characters are invalid)
$string=“ABCDEF” //this should return true value, no invalid characters in it.
Actually allowed characters are:
0-9 a-z A-Z @ $ [ ] ( ) . _
I am really weak in character classes, would be grateful if someone can get me through this.