REGEX expression to get decimal number with 2 decimal points

Hi everyone, I am trying to get the number and only with 2 decimal points.
The “NOx (g/kWh):” is always there.

I tried (?<=NOx (g/kWh): ).*
But it did not fetch.

NOx (g/kWh): 10.97029703

But there are other data in the expression like SFOC (g/kWh) (MDO): 198.7866787 in the same excel cell after I extracted the data. I wanna target it one by one.

Hi @Irfan_Musa
Try this below Regex expression:

Matches= System.Text.RegularExpressions.Regex.Matches(stringinput,"(?!=\w)[\d]+\.+[\d]{2}")

(Datatype of Matches: IEnumerable(Match))



image

Hope it helps!!
Regards,

Hi @Irfan_Musa

(?<=NOx \(g\/kWh\):\s*)\d+\.\d{2}

image

Hi @Irfan_Musa

Try this

(?<=SFOC \(g\/kWh\) \(MDO\):\s+)\d+\.\d{2}

image

1 Like

Hi @Irfan_Musa

(?!=\w)\d+.\d{2}

Hope it helps!!

Hi @Irfan_Musa

Try this

(?!=\w)[\d]\d+\.\d{2}

image

I hope it helps!!

Thank you for helping me with the quick responses. I will try all the recommendations

@Irfan_Musa

If you got the solution for your question. Please mark it as solution to close the thread.

Regards,

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