Regex code for more than one "$" sign

Hi Community,
i need a regex code if the string contains more than one “$” sign select that string i will give one example from this two strings
1).Year 2023 2024 2025
Financial Statement Audit $ 19,160 $ 20,830 $ 21,345
Single Audit 9,890.00 10,490.00 11,015.00
Total Fees $27,350.00 $3020.00 $32,360.00
2).Financial Statement & Single Audit and IRS Form 990
$ 23,000.
From these two statements it should select the first string i need a regex code for that i have tried lot of codes but it is not working for all the strings, please help me to find the solution if it can’t be solved using regex please help me to find another method

what was done, what is expected in detail?

Quick and dirty pattern:

\$\ ?[\d,.]+

my expectation is just true or false i need to make condition that’s why if the string contains more than 1 “$” symbol give true or else false

Assign Activity
hasMoreDollars | DataType: Boolean =
System.Text.RegularExpressions.Regex.Matches(strText, strPattern).Count > 1

1 Like

Hi @alan.prakash

=> Assign activity:
Input = ".Year 2023 2024 2025 Financial Statement Audit $ 19,160 $ 20,830 $ 21,345 Single Audit 9,890.00 10,490.00 11,015.00 Total Fees $27,350.00 $3020.00 $32,360.00"

=> Use Find matching Patterns activity:

Pattern -> "\$"
Text to Search in -> Input
Result -> Create a variable say Matches

=> Use an If condition and give the below condition:

If
  Matches.Count > 1
  Then
    Write line -> "True"
  Else
    Write Line -> "False"
End If


Output:
image
Sequence1.xaml (8.6 KB)

Regards

Hey @alan.prakash

Below mentioned short simple query will surely give the expected output:

Use this:

Str_Input.Split(" "c).ToArray().Where(Function(x) x.ToString.Contains("$")).ToArray().Count>1

You can pass above query directly in If activity, output of this will be boolean i.e, True or False!

Note: Str_Input is a string variable that has your input string value i.e, Year 2023 2024 2025
Financial Statement Audit $ 19,160 $ 20,830 $ 21,345
Single Audit 9,890.00 10,490.00 11,015.00
Total Fees $27,350.00 $3020.00 $32,360.00

Regards,
Ajay Mishra

3 Likes

grafik

several working options were shared with you. Lets get closed the topic by

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