Extract before and after string based given split string parameter

“Rolls - 593 tons @ $9.95/ton = $5,900.35 PUR-STK Handling - 374 tons @ $8.00/ton = 2,992.00 Delhi, IN January 2023”

From the above string I need extract values before and after of “=” which is $9.95/Ton and $5,900.35 similarly $8.00/ton , 2,992.00

Hi @niranjan.kodakandla

You can use the regular expression to extract the required output.

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“(\$[0-9]+\.[0-9]+\/\w+(?=\s+\=)|(?<=\=\s+)\$*[0-9]+\,[0-9]+\.[0-9]+)”)

Hope it helps!!

@niranjan.kodakandla

System.Text.RegularExpressions.Regex.Matches(stri,“($\d.[0-9]+/ton\s(?==)|(?<==)\s$\d.[0-9]+.\d+ |(?<==)\s[0-9]+.\d+.\d+)”)