I am trying to do a basic "contact us" page with a message text area that allows for regular communication values. I have it working for the most part, however, I can't seem to get the newline to work. I have tested out my regex on a number of different online "regex testers" and it works there. But when I try to pass the message with "asdf asdf [newline] asdf", it fails validation. If I take out the newline, it passes validation.
// message can only be alphanumeric, newline, space, or dash and has to be greater than 10 characters
'msg' => 'required|regex:/^[\w\-\. \n]+$/|min:10',
Anyone have a thought on why the regex is not working?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community