
- 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:33 AM
No need regex for that,
In that script you can mention like,
g_form.getValue('<field name>').indexOf('character') >= 0
alert ('this character is present');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 07:35 AM
i want check for more than one characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 07:37 AM
how many?
is are list of characters or one name?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2017 07:38 AM
5 charaacters but not all sppcl characters