Question

6
Replies
289
Views
Close popover
Jaime Herraiz Arroyo (JaimeH04)
international sos

international sos
ES
JaimeH04 Member since 2018 2 posts
international sos
Posted: October 8, 2019
Last activity: October 31, 2019
Closed
Solved

UTF characters problem over a validation rule

Hi guys!

I'm having a little bit problem. I'm making a Validation Rule to test an email address (because the PEGA validation only see if you've an "@", so it's not a valid one) using the "ñ" character (an special character from Spain. UTF-8) over the regular expresion. Nothings matter and the email is not validate it.

Ok... so I decided to replace all the "ñ" characters over the string (theValue) and then validate it without these characters... again, nothing matters.

Could you help me to improve something to do this? I'm over Pega 8.2.1 Cloud and i suppose that my cloud machine don't have the UTF8 encoding....

A testing email address (property value - text):
jaimeñherraiz@mail.test

The java code:

if (theValue== null || theValue.trim().equals("")) return false;
String mail = theValue.toString();

if (mail.indexOf("ñ") >0 ) { //"escaping" "ñ" character...
  mail = mail.replace("ñ", "n");
}

//first pattern. Working fine over other plattform, don't at PEGA
//"^([a-z0-9ñ])+([a-z0-9._ñ-])*(@){1}([a-z0-9ñ]){1}(([a-z0-9_ñ-])((\\.){1}([a-z0-9_ñ-]))*)+((\\.){1}([a-z]){2,4})+$";

//second pattern
String regex = "^(?!\\.)(([^\\r\\\\]|\\\\[\\r\\\\])*|([-a-z0-9!#$%&'*+/=?^_`\\{|\\}~]|(?<!\\.)\\.)*)(?<!\\.)@[a-z0-9][\\w\\.-]*[a-z0-9]\\.[a-z][a-z\\.]*[a-z]$";
if (mail.matches(regex) ){
  return true;

}else{
  return false;
}

Thanks in advance!

***Edited by Moderator: Lochan to update platform capability tags***

Data Integration Java and Activities Case Management
Moderation Team has archived post,
Close popover This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.