Pdf Extraction date and number and name

9/22/22, 2:10 PM Web Portal PJK | Pencarian
Parameter =
NIK required
3171040102590004
Tempat Lahir.
Nama:
| AHMAD FAJARPRANA I
Xxxxxxx cxxxxxxx xxxx
Gahakskdkdk

I want date from first line and number below NIK required and name below Nama please help

@Sudheer_Kumar_S

Try this system.Text.RegularExpressions.Regex.Match(stringvar,"<Pattern>").Value

Pattern1 = ^\d{1,2}/\d{1,2}/\d{2}, \d{1,2}:\d{1,2} \w{2}

Pattern2 = (?<=NIK required\n+)\d*

Pattern3 = (?<=Nama:\n+\|).*

Replace pattern for each type in the given expression at top

Cheers

Hi @Anil_G thanks for reply. Date is coming but NIK number and name are not coming. I have edited post pls check there is no space in between lines

@Sudheer_Kumar_S

Please try this expression with same pattern

system.Text.RegularExpressions.Regex.Match(stringvar,"<Pattern>",RegexOptions.MultiLine).Value

cheers

Hi @Sudheer_Kumar_S

Date:


NIK Number:

Nama:

Hope it helps!!
Regards,

HI,

FYI, Another sample :
Can you try the following?

System.Text.RegularExpressions.Regex.Match(strPdf,"^\d+/\d+/\d+").Value

System.Text.RegularExpressions.Regex.Match(strPdf,"(?<=NIK required\r?\n)\d+").Value

System.Text.RegularExpressions.Regex.Match(strPdf,"(?<=Nama:\r?\n).*").Value

Sample20230530-6L.zip (2.4 KB)

Regards,

NIK required
| 3171040102590004 |

When kept log it is coming like this but regex is not working on it… pls check and can you ignore pipe symbols in output… thank you
@Yoichi @Anil_G

HI,

Can you share your string as a file? We can write it to a file using WriteTextFile activity.

Regards,

Hi… I made some changes to regex you’ve given it’s working but… one change required… can we ignore | these pipe symbols

9/22/22, 2:10 PM Web Portal PJK | Pencarian
Parameter =
NIK required
| 3171040102590004 |
Tempat Lahir.
Nama:
| AHMAD FAJARPRANA I
Xxxxxxx cxxxxxxx xxxx
Gahakskdkdk

Hi,

How about the following?

System.Text.RegularExpressions.Regex.Match(strPdf,"(?<=NIK required\r?\n\D*)\d+").Value

System.Text.RegularExpressions.Regex.Match(strPdf,"(?<=Nama:\r?\n\W*)[\w\s]+").Value

Regards,

1 Like

Thank you @Yoichi @Anil_G for your quick help and replies

2 Likes

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