LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete block of text in string

Solved!
Go to solution

Hello,

In the attached VI, how do you go about deleting just the first block of text from <table> to </table> while leaving the other blocks intact?

 

Thanks.

0 Kudos
Message 1 of 5
(3,142 Views)

What you need to do is to break the string down into three pieces by doing two matches (which, itself, gives you three pieces, "before the match", "match", and "after the match").  First, look for <table>, and save the "before-the-match" string.  Now look for </table> and save the "after-the-match" string.  Concatenate the "before" and "after" strings, and you have your result.

 

This seems like a curious question for someone who has been a member of the LabVIEW Forum Community for 12 years (!!) to be asking.  Have you been doing LabVIEW for more than a decade and never used the String functions?

 

Bob Schor

 

0 Kudos
Message 2 of 5
(3,102 Views)

Hi HiNI,

 

one more thread for basically the same problem: why don't you stick with just one?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(3,093 Views)
Solution
Accepted by topic author hiNI

As for a solution...

 

Set the Search and Replace String to match regular expressions (right click it).

 

Then use "(?s)<table>.+?</table>" as a search string.

 

(?s) = "." matches all characters

<table> = matches "<table>"

.+? = non-greedy match. Match as few characters as possible

</table> = matches "</table>"

 

You could also use Match Regular Expression function for this, and use the after match output. You get the match and before match as a bonus. It also opens possibilities to get the match between <table> and </table> by using "(?s)<table>(.+?)</table>" and then using the 1st capturing group (submatch output of MRE when extracted).

Message 4 of 5
(3,065 Views)

Nothing here

0 Kudos
Message 5 of 5
(3,011 Views)