We can find the following email address regex in UiPath string matches activity.
((?>[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)>)
This regex looks too complex for me. I’ve not seen this much complex regex for email extraction. Can someone please explain this regex in detail or do we have any website/documenation explaining this part by part?
1 Like
@Surya_Narayana_Korivipadu - Since this regex can cover all the variations it was complex…
Please check this page where you can get easy to very complex one…
How do you find out if a user has entered a valid email address? Do you check for an at-sign, or is it more complicated? For many developers the answer is a regular expression, a little bit of code that can describe text patterns using wildcards and...
1 Like
Hi @Surya_Narayana_Korivipadu
It is complex code since it is trying every type of email address which comes in different format
Regards
Nived N
Happy Automation
1 Like
@Surya_Narayana_Korivipadu
Pleas have a look
This is a rail road diagram for above regex.
This explain or & and cases and how they are formed.
Hope this will help you understand logic
Thank you for the comment. Now I’ve got a little bit understanding about the characters checked by this regex. But there are still many parts of the regex which I’m not able to understand. Where can I get part by part explanation which can help me understand and build this regex by myself?
@Surya_Narayana_Korivipadu
Use this website, It will give you brief explanation to each form used
@Surya_Narayana_Korivipadu …Yes …give me your sample email addresses …will share the some simple regex pattern …
1 Like
Thank you. This website is helping me. This is giving detailed explanation about every part of this regex.
No. I don’t have any use case. I’m just trying to understand how UiPath built this regex.
@Surya_Narayana_Korivipadu - UiPath doesn’t build regex…you have to code your pattern and use it on the UiPath…
Please take a look at the post where Regex pattern provided to fetch various amounts…
@joseantonio - Here you go…
835,80 - Link
21,00 - Link
175,52- Link
0,00 - Link
0,00 - Link
1.011,32 - Link - (Assumtion on this pattern: there will be always a date before this field, if not it won’t work)
Hope this helps…Let me know, if it didn’t work any other texts(same pattern)…I will happy to assist…
In the string matches activity “Configure Regular Expression” , this email regex was available by default. I’m referring to that one. Anyways, I’ve found a way to understand this from @Lakshay_Verma comments. Thank you.
1 Like
Adrian_Star
(Adrian Starukiewicz)
March 22, 2021, 7:54pm
13
I use 2 regex patterns:
Very simple:
^[_a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$
Complex (RFC 5322):
^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$
Interesting sources:
RFC822
http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
1 Like
system
(system)
Closed
April 8, 2021, 6:10am
14
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.