$text = trim($_POST['textarea']);//gets text from textarea form
$maxWordLength = 15;
if(preg_match('/[^-\s]{'.$maxWordLength+1.',}/', $text))
{
// error: excessively long word found
}
else
{
// OK, continue processing
}
I seem to keep getting an error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING
Can you explain that preg_match...thought it had to look something like this:
preg_match('/pattern here/', 'subject')
What is this part mean [-\s]? The ^ started it but no $ to end? Curly specifies the number of characters.
Just trying to understand it some more. Thanks.