Question

5
Replies
2768
Views
Close popover
Nandhini Viswanathan (Nandhini21)
Wipro

Wipro
IN
Nandhini21 Member since 2015 18 posts
Wipro
Posted: August 16, 2017
Last activity: September 8, 2017
Closed
Solved

Allow backslash (\) during special characters validation

My requirement is to allow only -,/,\,( and ) and restrict all other special characters. I tried below expression and edit validate rule. Both of them are not allowing backslash (\). Please suggest proper syntex.

Expression:

@String.pxContainsSpecialCharacters(Param.DocNo,"-,/,\\,(,)")=="true"

Edit Validate:

java.util.regex.Pattern pattern=java.util.regex.Pattern.compile("[^A-Za-z &@'()-./0-9!#$%*_={}|:;<>\\~^]");
java.util.regex.Matcher match=pattern.matcher(new String(theValue));
boolean status= match.find();

if(status)
{return false;}
else
{return true;}

Thank you.

Low-Code App Development Case Management
Moderation Team has archived post