Regex- Extracting data

Hi,
Can anyone please help me extract some date from text file using Regex…
1.this integer and date are in a new line.I need to take them both seperately"81196681 25.08.2023"
2.Need to take the integer here “Nettobetrag 2.924,77”
“Gesamtbetrag EUR 3.290,51”
3.Need to take the country name 'Germany’from “Company name Germany some strings…”

Thanks!!

Hi @abivanth.r

Try this regex:

\d+[.,]?\d+[.,]?\d+

Regards


refering to the groups
grafik

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

Quick, dirty and optimistic Anchored on German word amount:
grafik

Hey @abivanth.r
you can try this:

matchResult = System.Text.RegularExpressions.Regex.Match(textContent, "(\d+)\s+(\d{2}\.\d{2}\.\d{4})")
If matchResult.Success Then
    integerValue = matchResult.Groups(1).Value
    dateValue = matchResult.Groups(2).Value
End If

Hi @abivanth.r

Try this:

For 1 and 2 conditions use \d+[.,]?\d+[.,]?\d+
for 3 condition use (?<=Company name )\w+


Hi @abivanth.r

You can use the below in Assign:

Input = "Nettobetrag 2.924,77
        Gesamtbetrag EUR 3.290,51"
System.Text.RegularExpressions.Regex.Match(Input,"\d+[.,]?\d+[.,]?\d+").Value.Trim()

Regards

Hi @abivanth.r

For 3rd value



(?<=name\s?)([A-Za-z]+)

Regards

I need to take the no.“81196681” and date seperately…
there is lot of number in my file and its highliting all of them

To be clear. i am using 2 matches activity,In which i am taking the no. in one and date seperatrely in other matches

Hi Sir!!
I am new to UiPath. I don’t understand how to use this solution, Can you please explain how to use it?

@abivanth.r

  1. for number \d{8}(?= \d+\.\d+\.\d+), for date (?<=\d{8} )\d+\.\d+\.\d+
  2. \d+\.\d+\,\d+
  3. (?<=name )\w+

It would be better if you provide the input string.

Thanks!!! Worked :blush:

1 Like

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