- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2019 09:06 AM
Hi,
I have to write a regular expression to allow only characters (no numbers), No spaces before and after string, and allow special characters ' " - these 3 characters anywhere in the text field.
Please help me modify the below code -
var pattern = /^[_A-z]*((-|\s)*[_A-z])*$/;
var name = g_form.getValue('updated_first_name');
if (!pattern.test(name)){
g_form.addErrorMessage("Only Characters are allowed");
g_form.setValue('updated_first_name','');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2019 09:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 12:19 AM
Sure I did.. Can you explain me the difference between /^[A-Za-z'"-]*$/ and /^[A-Za-z'"-](\S)*$/ if you know?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2019 09:33 AM
Try this for your pattern:
/^[a-zA-Z'"-](\S)*$/