1

I am using live validation on my site (from livevalidation.com), I have a text area where I need to allow new line / line feed / return characters, but despite my best efforts I am failing miserably. I have tried \n \r \v \s\S each with \ escape and without.

This is my code without the use of the above chars:

my_notes.add( Validate.Format, { pattern: /^[a-zA-Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\.\,\-\/\']+[a-zA-Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\.\,\-\/\' ]+$/i } );

Any suggestions would be greatly appreciated.

Bernie Davies
  • 419
  • 6
  • 15

1 Answers1

0

The /m modifier allows the pattern to match across multiple lines, where you have /i at the end of your pattern try /mi instead

buffcoredave
  • 179
  • 1
  • 9
  • 1
    This is not actually what `m` does. `m` makes `^` and `$` match line beginnings and endings respectively. "Matching across multiple" lines is possible with or without `m` provided you have something that matches line breaks (like `\s`). So what the pattern now does is simply validate that one of the lines has the correct format (the other lines can contain arbitrary characters). I think David Gorsline has found the real issue in the comment on the question. – Martin Ender Jun 07 '13 at 00:57