I am working on project where I need to find Frequency from a given text. I wrote a Regular expression that try to detect frequency, however I am stuck with how C# handle it and how exactly I use it in my software
My regular experssion is (\d*)(([,\.]?\s*((k|m)?hz)*)|(\s*((k|m)?hz)*))$
And I am trying to find value from
- 23,2 Hz
- 24,4Hz
- 25,0 Hzsadf
- 26 Hz
- 27Khz
- 28hzzhzhzhdhdwe
- 29
- 30.4Hz
- 31.8 Hz
- 4343.34.234 Khz
- 65SD
Further Explanation:
- System needs to work for US and Belgium Culture hence, 23.2 (US) = 23,2 (Be)
- I try to find a Digit, followed by either khz,mhz,hz or space or , or .
- If it is , or . then it should have another Digit followed by khz, mhz, hz
Any help is appericated.
Running replace
for
($1 $2)givesAny corrections to desired behavior?
upd: this is with negative lookbehind and word boundary: