11-19-2014 02:48 PM
Thank you for your time! Really!
But please excuse my noobness! Again, I am experiencing some difficulties.
I do read the string nicely! But sometimes, maybe because of frequency issues, my communication board does not respond in propper time! Sometimes I do not read at all, or just manage to read partial information like "DAT " or "DATA 2" instead of "DATA 20.00", since the acquisition did not receive any information from the board in created attempts.
I am currently looping in order to verify if it read the full word or only partial. Is there any way I can control the number of decimal places after the point of the number on the string?
Or better, any way I can check if I have read all the string properly at once?
The string will always come with a word, a space and a number. Instead of your example to read from "!" to "?", may I or is somehow better to restrict it to the precise format? If so, what expression will match this string?
Thank you in advance!
11-20-2014 06:17 AM
@DMartins wrote:
[...] Is there any way I can control the number of decimal places after the point of the number on the string?
Sure. If there will always be two digits past the decimal point the regex will contain \.\d\d or \.[\d]{2}
@DMartins wrote:
[...]
Or better, any way I can check if I have read all the string properly at once?
The string will always come with a word, a space and a number. Instead of your example to read from "!" to "?", may I or is somehow better to restrict it to the precise format? If so, what expression will match this string?
Thank you in advance!
If you want to enforce the number of digits past the decimal point, change the last '*' to '{n}', where n equals the number of digits you need. The regex will also need to change if there are some instances where there won't be a decimal point. I may not have understood quite what you're asking. Please provide some actual data, both correct and malformed, and we can figure this out.
01-05-2016 02:12 AM
00 00 02 00 06 03 42 02or
......B.or
......à ....Öhor
..........€›Òor
..........۟.How can i do this ? Andrew
01-05-2016 02:19 AM - edited 01-05-2016 02:22 AM