' & " inside a php regexp

Neziniukas

New Member
Would this be the correct regexp to allow \[code\]A-Z a-z 0-9\[/code\] and symbols \[code\]#&()-\;,.'"\[/code\] and spaces?I'm struggling with the \[code\]'\[/code\] and \[code\]"\[/code\] inside the regexp. Is what I've done correct? Note the \[code\]\'\[/code\] and \[code\]\"\[/code\]. It just doesn't seem right. Whats the right way to do it?\[code\]if (preg_match('/^[a-z0-9#&()-\;,.\'\" ]+$/i', $username) ) { echo "Good"; } else { echo "Bad"; } \[/code\]
 
Back
Top