Hi all,
I hope somebody will be able to help me with my small preg_match pattern issue. It feels like I have been struggling for days with this and getting nowhere.
Its quite simple, I have a comment form on my site, there are some buttons so users can make text bold and italic a bold text would look like this: <span style="font-weight: bold;">something</span>
now I want to limit the form to not submit if the pattern is broken, like if the user tries to enter a hyperlink or something like that.
this is what I got so far. (I know its not much, but for now, it should validate only letters and numbers.
Code:
function validateEditorNEW($theinput,$description = ''){
$regmatchex = "/[^a-zA-Z0-9]+$/";
if (preg_match($regmatchex, $theinput)) {
$this->errors[] = $description;
return false;
} else {
return true;
}
}
any suggestions?
|