UFO Over Norway: Residents Baffled By Mysterious Swirling Blue Light In The Sky (VIDEO)
So recently I have been doing some work in Wordpress and more specifically the cformsII plugin. This is a great plugin for generating quick forms, however it does it’s validation in javascript.
One of the requirements was for a multi-line text input that was no longer then 500 characters. This is easily done with the plugin, but the regex generated looks like this.
^.{0,500}
The problem with this is that it will match any character except the newline up to 500. Obviously for a multi-line text input you want to allow newlines. The javascript character for matching any whitespace character including newlines is \s and matching any character other then whitespace is \S. So if you change the javascript for validation to the following it will match any character, including newlines up to 500 characters.
^[\s\S]{0,500}