LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Regular expression help please. (extracting a string subset between two markers)

Solved!
Go to solution

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!

 

0 Kudos
Message 11 of 14
(857 Views)

@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!

 


Example_VI.png

 

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.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 12 of 14
(839 Views)
Hello everybody ! I would like to post a question concerning the subject of this thread. How to get all the characters between 2 delimiters taking into account that the characters could anything from the ascii character list ? So for example the string could be :
 00 00 02 00 06 03 42 02
or
......B.
or
......à....Öh
or
..........€›Ò
or
..........۟.
How can i do this ? Andrew
0 Kudos
Message 13 of 14
(778 Views)

Hi Andrei,

 

for example the string could be : 00 00 02 00 06 03 42 02

What are your marker values and what is the interesting part of the string?

 

A very simple approach (using 0x02 as marker byte) could be:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 14
(768 Views)