
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 07:28 AM
regex: i want to check for particular special characters from input using regex,thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 09:13 PM
Hi Satheesh,
you want to restrict the below char.
[5/10/2017 8:08 PM] Eshwar Prasad Mallikarjun:
Disallow following special characters (&
[
]
~
@
|
$
^
<
>
\
*
+
=
;
?
`
')
if yes then please check with script below.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var specialCharRegex = /[~@|$^<>\*+=;?`')[\]]/;
if(specialCharRegex.test(newValue)){
alert('special chars are not allowed');
g_form.setValue('<your field name where you are writing the special char>','');
}
}
I have tested it in my PDI and it's working fine.
Thanks,
Harshvardhan
Please Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 07:39 AM
[‎5/‎10/‎2017 8:08 PM] Eshwar Prasad Mallikarjun:
Disallow following special characters (&
[
]
~
@
|
$
^
<
>
\
*
+
=
;
?
`
')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 07:42 AM
See if the below link helps.
javascript regex for special characters - Stack Overflow
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 08:17 AM
Try this of onchange client script on that filed
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var pattern = /^[a-zA-Z0-9]*$/;
if(!pattern.test(newValue) )// adjust your digits.
{
alert('do not enter special charactes');
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 08:44 AM
Hi Satheesh,
Please check with script below.
write on change client script on ur field.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var regex = new RegExp("^[a-zA-Z0-9]*$");
if(!regex.test(newValue)){
alert('special chars are not allowed');
g_form.setValue('<ur field name>','');
}
}
Thanks,
Harshvardhan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 09:02 AM
i need apply condition for some special charaacters, not for all special chaaracters