How to extract Date and Usd Rates Form string using regex?

How to build regex or extract date and usd selling rates ?

  1. Date: ?
    Answer: 25-Feb-22
  2. Usd Selling Rate: ?
    answer: 77.56

String:

@“INTER NAL
iv .
slandard Q
GQiEiE o -1
COUNT E R RAT ES
Indicative INR rates as on 25-Feb-22
TT/BILLS RA TES
Buying Selling Buying Selling Buying Selling
AED 19.88 21.12 GBP 98.12 104.21 NOK 8.1626 8.6719
AUD 52.54 55.80 HKD 9.3543 9.9337 KES 0.6409 0.6818
BHD 193.70 205.72 RUB 0.8679 0.9218 SAR 19.47 20.67
CAD 57.17 60.72 JPY 0.6340 0.6735 SEK 7.7028 8.1840
CHF 79.11 84.02 TRY 5.22 5.54 SGD 54.02 57.39
DKK 11.0175 11.7015 KWD 240.82 256.24 THB 2.2500 2.3908
CNH 11.5639 12.2809 MYR 17.39 18.48 QAR 19.91 21.20
OMR 189.69 201.46 EUR 81.98 87.07 USD 73.04 77.56
NZD 49.05 52.12 PLN 17.6569 18.7821 ZAR 4.7841 5.0844
KRW 0.0607 0.0645 MXN 3.5612 3.7837
CURRENCY NOTES
GBP 98.12 104.21 CHF 79.11 84.02 USD 73.04 77.56
EUR 81.98 87.07 AUD 52.54 55.80 SGD 54.02 57.39
The Card rates are subject to revision from time to time, due to factors such as market volatility. and at total discretion of SCB.We are
committed to applycard rates for all forex transactions irrespective of notional amount ofsuch transactions.We will also applycard rates
for selling and cancellation of prepaid foreign currencycard. The card rate applicable for anytransaction will be the card rate prevailling
at the time of actual transaction and maybe different from the card rates mentioned above
I* CHF/AUD’SGD cash currency available at select branches only
|*Please note this is a computer generated report, hence no signature is required”

1 Like

HI @Ashok_kumar7

Try this below expression

Use assign activity

LHS → Create an variable
RHS → System.Text.RegularExpression.Regex.Match(InputString,"(?<=Indicative\sINR\srates\sas\son\s)(\d.{2}\w.{3}\d{2})").Tostring

Use assign activity

LHS → Create an variable (Test)
RHS → System.Text.RegularExpression.Regex.Match(InputString,“USD\s(\d.+)”).Groups(1).Tostring

Output → 73.04 77.56
Pass this out variable in the next assign activity to get the 77.56

Use assign activity

LHS → Create an variable
RHS → Split(“73.04 77.56”," ")(1)

73.04 77.56 → Test is the variable

image

Regards
Gokul

3 Likes

Thank you so much @Gokul001

Can you please share the xmpl file for the build date expression using regex?

I will share you the skeleton @Ashok_kumar7

image

Already i extracted the usd rate from pdf

i want date regex expression?

Hey @Ashok_kumar7

For Date Extraction

\d{2}-\w{3}-\d{2}

For USD price value extraction

USD\s\d*\.\d{2}\s\K.+

Hope this helps

Thanks
#nK

1 Like

Here is the date regex → (?<=Indicative\sINR\srates\sas\son\s)(\d.{2}\w.{3}\d{2})

Here is the workflow

Regex.xaml (5.0 KB)

Regards
Gokul

1 Like

Thank you so much @Gokul001

Thank you so much @Nithinkrishna

1 Like

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