Regex to get the value

Hi all

I have tried a lot to get this value, but not succeeded :worried:

How can i get regex match for this

_AS CP 639.63 614.52 599.49 576.09 40.30 38.56 24.53 0.23 6.72 8.80
_AS FO 639.63 614.52 599.49 576.09 82.30 38.56 24.53 0.23 6.72 8.80

Here I want 40.30 from the first string and
82.30
From the second string

Can anyone help with regex pattern for this

@Susana @aksh1yadav @vvaidya @lakshman

Thanks in advance
Srikanth

@Srikanth_prem
Regex isn’t necessarily the best option here since multiple parts of the line match \d\d.\d\d. If the line is always in the same format you can do stringVar.Split(" "c)(6) to fetch β€œ40.30” and β€œ82.30”.

@Srikanth_prem you can rather use string manipulation than regex.

@Srikanth_prem

As @DanielMitchell mentioned, you can use Split method to find requried value. No need of using Regular Expression and all.

1 Like

@Srikanth_prem ,
First use the following the regex to get the proceedings value after as cp
Regex pattern : (?<=_AS CP )(\w|\d|\n|[(. *)]| )+
The output (Bolded)
_AS CP 639.63 614.52 599.49 576.09 40.30 38.56 24.53 0.23 6.72 8.80

This will retrieve all the values after _AS CP and assign it to string
Then use string.split(" ",c) and save it in a String Array
Your required value will be String Array(4)

Regards,
Naveen

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