Jump to content

Recommended Posts

I'm using the frmvalidator.addValidation code (with the associated validator.js file) and I cannot for the life of me find anywhere how to include an allowable character of a line break to the regexp.

 

For example, I might have something like:

frmvalidator.addValidation("Notes","regexp=^[A-Za-z0-9\u005F\ \.\-\@\,\%\*\!\?\$\&\'\#\+\=\:\;\(\)\u2022]{1,300}$","Notes can only contain the following non-alphanumeric characters: ,'?!/*&%$#@:;_+=@");

But if a user enters a line break, it won't accept it. I've tried adding \u000D, \u000A, \u000C, U+000D, \r\n, \n ..... nothing works.

 

Am I missing something really obvious?

  • Solution

\r and \n are easier than the \u syntax, but they'll be interpreted by Javascript and you'll get those characters inside the actual string.

Escape the backslashes like "\\r\\n".

\r and \n are easier than the \u syntax, but they'll be interpreted by Javascript and you'll get those characters inside the actual string.

Escape the backslashes like "\\r\\n".

Hi again requinix!

 

OK...I need to edit my post. It actually did work, but now the bullet point character is not being accepted when it previously was (I think that's the \u2022).

 

Edit #2: I moved the \u2022 up further into the regexp and it's working now.

 

Run into this a lot where the order is critical, but not sure what the order is supposed to be.

 

Thanks again for your help!

Edited by sleepyw
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.