Regular expression - dynamic strings

Hi,
I have attached a sample text file. I need the values of fullname and date of birth. Is there any regex to do this?
sample textfile1.txt (602 Bytes)

Hi,

Can you also share expected result for the above sample?

Regards,

sample textfile1.txt (730 Bytes)
Hi @Yoichi . I have attached the text file with expected results.

Hi,

Is this text from OCR? For now, can you try the following?
Please note that there is no way to write regex pattern that matches all possible future error characters.

mc = System.Text.RegularExpressions.Regex.Matches(strText,"Name.*?\W(?<FULLNAME>\w[\w ]+)(\r?\n)+.*?Date of Birth[^:]*:(?<DOB>.*)")

Sample
Sample20240624-3.zip (3.1 KB)

Regards,

Its not working for me @Yoichi.

Hi,

Does the above my sample work? If you use another input, can you share it?

Regards,

Hi @Lalitha_Selvaraj

Please check the below regex expressions:

Regards

Hi @Lalitha_Selvaraj

Check the below flow:

Sequence.xaml (14.7 KB)

Output Excel:
sample.xlsx (6.2 KB)
image

Regards

Hi @vrdabberu . Thanks for the response. Are you able to use “Name” word in the regex to make it more specific?

regex- ([A-Z]+\s*)_.*

Hi @Lalitha_Selvaraj

use the below regex then:

(?<=Name.*)([A-Za-z ]+\s*.*)(?=2\.)

Regards

If I use the below regex, i can get the last name, but how to take firstname too? Here XXX is the firstname.

_.(?<=Name.)([A-Z]+\s*)_.*

regex output:

Hi @Lalitha_Selvaraj

Please correct your syntax. The syntax which you have given is different from the one I have provided earlier please check.

Regards

yes. The one which you provided is generic(matching more values). by using this regex its pointing to full name alone. thats why i have added few things in regex.

_.(?<=Name.)([A-Z]+\s*)_.*

Hi @Lalitha_Selvaraj

Please check the updated xaml:
Sequence.xaml (14.8 KB)

Regards

Can you send it as a project ?. I’m not able to access the sequence.xaml

image

Sure @Lalitha_Selvaraj

ForumTaskRegex.zip (55.5 KB)

Regards

Sorry. I’m not able to view the project. there is a dependency issue.

Please Install the dependencies @Lalitha_Selvaraj

Regards


I dont have the version.
image

What is your studio version @Lalitha_Selvaraj

Regards