Need Regular Expression For Below Inputs

Input1: Payment Received-Thank You May 24,2024-$89.12
output1:$89.12

Input2: HST(81578 1448):$10.25
output2$:10.25

Input3: Total $89.12
output3:$89.12

@SND0912,

Use this regex pattern

"\$\d+\.\d{2}"

Use it in assign activity

strOutput=System.Text.RegularExpressions.Regex.Match("Payment Received-Thank You May 24,2024-$89.12","\$\d+\.\d{2}").Value.ToString

Sample Workflow:
Workflow.xaml (7.1 KB)

Thanks,
Ashok :slight_smile:

hi aashok could you please help me out remaining 2 input examples

@SND0912,

Same regex works with all 3 inputs.

Thanks,
Ashok :slight_smile:

i will try and let you known the results thanks ashok for quick response

@SND0912,

Here is the Input Output for all strings.

image

Revised workflow for demo:
Workflow.xaml (8.4 KB)

Thanks,
Ashok :slight_smile:

@SND0912

A more generic one would be this

\$[\d.]*

Usage : Assign activity

requiredvalue = System.Text.RegularExpressions.Regex.Match(str,"\$[\d.]*").Value

cheers

1 Like

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