I need to build a pattern for preg_match that will accept string between 0 – 2000 chars including new lines (\n)
I ended up with :
/^.{0,2000}$/
but don’t know how to add “new line” in it. It accept anything from 0 to 2000 chars but doesn’t accept new lines. Where to add “new line” into this pattern ?
You need to add the multiline modifier (Update: just realised, that you probably need the “dotall”-modifier
stoo. try it out)However, its faster and more convenient to use common string functions