Raja.G
(Mr.RPABot)
November 16, 2021, 10:05am
1
Hi Guys,
I have to get email ids and phone numbers both from queue , i want to validate that format of email and phone number.
I need to validate phone and email if suppose invalid format came i ill put exception .
Please help me anyone out from this.
Excepted format:
email:abc@gmail.com
phone:1234567890
Regards,
Raja G
prasath_S
(prasath S)
November 16, 2021, 10:14am
2
Hi @Raja.G
In matches activity itself they have give the regex pattern for email (click configure in matches activity and it will be found in the drop-down) and for email,this will work,
\d{10}
Thanks
Yoichi
(Yoichi)
November 16, 2021, 10:14am
3
Hi,
How about the following pattern?
"email:((?>[a-zA-Z\d!#$%&'*+\-\/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-\/=?^_`{|}~]+)+|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)"
"phone:\d{10}\b"
Regards,
Raja.G
(Mr.RPABot)
November 16, 2021, 10:22am
4
Hi @prasath_S @Yoichi ,
i did separate validation i want bot are same “Ismatch” for regex
And result whatever wrong format i want to send exception if phone i want to send phone number invalid if email invalid i want to send invalid email.
Test1.xaml (27.6 KB)
Yoichi
(Yoichi)
November 16, 2021, 10:35am
5
Hi,
Can you try the following settings for IsMatch activity?
Input : phonenumber+chr(9)+Email
Pattern:
"^\d{10}\t((?>[a-zA-Z\d!#$%&'*+\-\/=?^_`{|}~]+\x20*|""((?=[\x01-\x7f])[^""\\]|\\[\x01-\x7f])*""\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-\/=?^_`{|}~]+)+|""((?=[\x01-\x7f])[^""\\]|\\[\x01-\x7f])*"")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)"
Regards,
Raja.G
(Mr.RPABot)
November 16, 2021, 10:38am
6
@Yoichi
how to identify what format error? like phone or email
Hi @Raja.G
You can use try catch block for both email and phone format checks as you want to find out which one fails. In the catch block you can throw exception and assign a variable to identify which format is failed.
Thanks,
Boopathi.
Yoichi
(Yoichi)
November 16, 2021, 10:42am
8
Hi,
It’s difficult to identify from single IsMatch activity. If we need to know which string is error, it’s better to use 2 IsMatch activities.
Or do you want to use loop and IsMatch activity?
Regards,