Get values after Fields:Regex

How do I get the value after of each field using regex:

Enrollee ID:

            1111_11
    
     
            DOB:
        
            11/27/1960
    
     
        
            Last Name:
        
            Doe
    
     
        
            First Name:
        
            John
1 Like

Hello @Sairam_RPA

For DOB: DOB
For Last Name: Last Name
For First Name: First Name

Make sure you remove empty space.

Cheers

Hi,

In this case, we can extract target string using the following pattern.

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=KYEWORD:\s+)\S+").Value

So, specific expression will be the following.

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Enrollee ID:\s+)\S+").Value

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=DOB:\s+)\S+").Value

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Last Name:\s+)\S+").Value

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=First Name:\s+)\S+").Value

FYI, we can also use the above pattern with Loop, and set keyword and extracted value to dictionarry as the following.

Main.xaml (8.5 KB)

Regards,

2 Likes

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