From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Parts of a string between two sets of characters.

Solved!
Go to solution

I am reading a series of data strings from a serial port.  RS-232.

Bellow is an example of the data coming in.

 

ROM TEST IS IN PROGRESS ...  PLEASE WAIT     VERSION 8

 

I would like to look for  and delete everything up to and including 2K then look for the next instance of  and delete to 2K.

Rinse and repeat.

 

Ideally the string would end up as;

ROM TEST IS IN PROGRESS ...  PLEASE WAIT   VERSION 8

 

 

0 Kudos
Message 1 of 21
(4,627 Views)
Solution
Accepted by topic author RedneckNerd

Match Pattern is your friend...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 21
(4,620 Views)

I would like to look for  and delete everything up to and including 2K then look for the next instance of  and delete to 2K.

You need to state your rule differently.

As written, your rule will leave nothing except "VERSION 8".

 

In any case, MATCH PATTERN and MATCH REGULAR EXPRESSION will do things along this line.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 21
(4,613 Views)

How did you come up with '\1B" ?

I don't see that in the original string he posted:

Screen Shot 2017-05-04 at 2.55.38 PM.png

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 21
(4,601 Views)

Thanks.  I had tried something similar to this but couldn't get that initial string correct.

0 Kudos
Message 5 of 21
(4,590 Views)

1B is the hex for the left arrow symbol  .

 

I kept trying to use the  instead of 1B.

0 Kudos
Message 6 of 21
(4,588 Views)

I don't see the left arrow AT ALL, that's why I said that your written rule was wrong.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 21
(4,581 Views)

@CoastalMaineBird wrote:

I don't see the left arrow AT ALL, that's why I said that your written rule was wrong.


It just appeared in the string when I copied the string from the browser and pasted in a string control.  Whether or not the OP is really getting that in the data, that is unknown at this point.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 21
(4,556 Views)

Strange.  It's perfectly clear to me.remove string.PNG

0 Kudos
Message 9 of 21
(4,540 Views)

It definitely has a left arrow at the beginning.

0 Kudos
Message 10 of 21
(4,536 Views)