Regex to get substrings

I want to get the company name and the amount :

Data
Total for : Company1 - Test Distribution 0.00
Total for : Company2 - Test Distribution -2384.24
Total for : Test Company - Test Distribution 21713.36

output :
Company1, 0.00
Company2, -2384.24
Test Company, 21713.36

Hi @AhmedKutraphali
Try this regex pattern
(?<=Total for : ).*(?= - Test Distribution)|(?<=Test Distribution ).*

Regards,

Nived N

Happy Automation

Hi @NIVED_NAMBIAR
Does not work

Hi @AhmedKutraphali

I had updated my regex pattern

Please check

How can we join the 2 outputs in a single string ? like Company1, 0.00 like comma sperated ? Thanks

(?<=Total for : )(.*?)(?= \- ).*?(\-?[\d,.]+)
grafik
grafik

1 Like

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