Edit Validate rules
1
2
3
4
5
6
7
8
9
10
11
12
13
| // Regex to check valid Aadhaar number
String regex= "^[2-9]{1}[0-9]{3}\\s[0-9]{4}\\s[0-9]{4}$";
// Compile the ReGex
java.util.regex.Pattern p=java.util.regex.Pattern.compile(regex);
// If the string is empty, return false
if (theValue == null || theValue.trim().equals("")) return false;
theProperty.addMessage("Please enter valid Aadhar Number");
// Pattern class contains matches() method to match the given string and regular expression
java.util.regex.Matcher m = p.matcher(theValue);
return m.matches();
|
1
2
3
4
5
6
7
8
9
10
11
12
13
| // Regex to check valid Aadhaar number
String regex= "^[2-9]{1}[0-9]{3}[0-9]{4}[0-9]{4}$";
// Compile the ReGex
java.util.regex.Pattern p=java.util.regex.Pattern.compile(regex);
// If the string is empty, return false
if (theValue == null || theValue.trim().equals("")) return false;
theProperty.addMessage("Please enter valid Aadhar Number");
// Pattern class contains matches() method to match the given string and regular expression
java.util.regex.Matcher m = p.matcher(theValue);
return m.matches();
|
- For Auto Spacing
- Input (Ex:
234112341234
)
- Output (Ex:
2341 1234 1234
)
1
2
3
4
5
| if (theValue.length() == 12)
{
String temp=theValue.toString();
theValue= temp.substring(0,4)+" "+temp.substring(4,8)+" "+temp.substring(8,12);
};
|
Reference
Click Here - More details from pega academy for Edit Validate rules
Click Here - More details from pega academy for Edit Input rules
Comments powered by Disqus.