Example Code

Filter Text (Variable)

Code and Documents

Attachment

This example takes text input and removes portions of the text based on a set of start and end parameters.  This can be very useful for removing certain tags or comments in HTML or XML that have variable inputs in the middle.  For Example:  If your input HTML string is as follows:

<html>

     <body>

          <!-- Page Updated on 10/15/2010 -->

          Test test test

     </body>

</html>

The if you give the function an input parameter of "<!--" and "-->" it will remove the first tag that begins with <!-- and ends with -->, resulting in:

<html>

     <body>

          Test test test

     </body>

</html>

Filter Text Variable.png

NOTE: This will only remove the first instance of the tag.  If you want to remove multiple of the same tag, you should enumerate them in the input "Parse Parameters" array. 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors