This question already has an answer here:
How can i match text that is 10 characters at minimum and 4000 at maximum and that text can be any character. Furthermore i need to accept space tab carriage return and new lines.
I tried:
"/.{10,4000}$/"
But that didn't work! I think that the dot does not include carriage return for example.
So can anybody help me with this ?
Sorry any misspelling, i am Portuguese.
</div>
s
so .
matches newlines.
"/^.{10,4000}$/s"
Note that the dot will match any character. So why not just do this:
if(strlen($text) >= 10 && strlen($text) <= 4000) {
echo "match!";
}
try this pattern /^.{10,4000}$/s
note the "s" modifier and the anchor "^"