How to configure Regular Expressions in regex Builder

Hi,
I am extracting data from Invoice PDF using IntelligentOCR. Machine learning extractor is working fine but for some Invoices, few fields are missing (like Invoice No and Date). Can anyone help me in writing Regular Expressions in regex Based Extractor to extract Invoice Number (what RegEx should I Select and how to write Value in RegEx Builder)

Regards,
Rajashekar Reddy

1 Like

HI
can i have a sample text of it so that we can come up with a regex for it
Cheers @Rajashekar

1 Like

Thanks for the Replay

DESCRIPTION

Professional Charges From 19-11-2019 to 18-12-2019

DATE: 23-12-2019

INVOICE # 29

AMOUNT

16,667.00

OTHER COMMENTS

  1. Total payment due in 30 days

I Need to extract INVOICE # from the above text

2 Likes

I need extract Invoice number 29

1 Like

Fine
if this string is stored in a input string variable named str_input
then the output will be obtained in a assign activity like this
str_output = System.Text.RegularExpressions.Regex.Match(str_input.ToString,"(?<=INVOICE\s\W\s).*").ToString.Trim

Cheers @Rajashekar

2 Likes

i am using Regex Based Extractor in Regex builder i should select ADVANCED and in value field, i should write str_output = System.Text.RegularExpressions.Regex.Match(str_input.ToString,"(?<=INVOICE\s\W\s).*").ToString.Trim
Right??

1 Like

this expression alone can be mentioned
@Rajashekar

2 Likes

But main thing here is how did you make this expression ? How do we create expression for any requirement ?

Where can we learn about it ?

2 Likes

Hi @kkpatel You can use regex101.com for practive the regular expressions.

Attached a cheat sheet for referenceRegularExpresionCheetSheet.pdf (152.1 KB)

2 Likes

Hey Thanks @Himanshu.joshi.

The pdf is helpful. But can you tell me how to use that https://regex101.com/. I mean how does it generate the required regular expression according to our requirement ?

1 Like

Use that pdf as reference .

On the first text box write your pattern.
And on the second text box write your text in which you want to use that pattern.

Example :\d+ on test101

will give you 101 as result

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.