<Regex> Extract value from a random text

How to extract utilization% from below mentioned text:
Output Needed Utilization%: 25.0456 >>> roundoff >> 25

Input String:
Name Detail Description From No. To No. Utilization % No. Left
ABC DEF 1234 6789104356 25.0456 1234

Hi @anjasing

Try this:

(?<=[A-Z]+\s+\d+\s+\d+\s+)\d+\.?\d+

[A-Za-z]+\s+\%

Regards

1 Like

@anjasing

[A-Za-z]+\s*\%
\d+\.\d+


Str_Output=System.Text.RegularExpressions.Regex.Match(inputString, "[A-Za-z]+\s*\%").Value

Store these two in two variables
Concatinate using—>StrOut1+" "+Math.Round(Str_Out2)
Sequence2.zip (1.6 KB)

1 Like

Hi @anjasing

Assign-> Input = "Name Detail Description From No. To No. Utilization % No. Left
ABC DEF 1234 6789104356 25.0456 1234"

Assign-> Output = System.Text.RegularExpressions.Regex.Match(Input,"[A-Za-z]+\s+\%").Value.Trim()+": "+(Math.Round(Double.Parse(System.Text.RegularExpressions.Regex.Match(Input,"(?<=[A-Z]+\s+\d+\s+\d+\s+)\d+\.?\d+").Value.Trim()))).ToString

Output is of DataType System.String.

Regards

1 Like

Hey @anjasing

System.Text.RegularExpressions.Regex.Match(yourInputString, “Utilization % No. Left\s*(\d+.\d+)”)`

1 Like

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