PRODUCT






Home









Free Download








Installation Instructions





FAQ





FAQ








Ask A Question





LEARN SCRIPTING





Overview








Lesson 1








2


3


4


5








Exam





SAMPLE SCRIPTS





Computer








Internet








Administrators








Developers








Data








Miscellaneous





HELP / DOCUMENTATION





Commands








Automated Internet








Automated Editors








Sample Scripts








Precompiled Functions








System Features






  Help Page - SS_RemoveTags

( Some help pages may not display correctly in html because those help pages may have sample code
in them, part of which may be mis-interpreted as html tags.

All help pages, including this help page, are available in biterScripting with the help command. )




Sample Script SS_RemoveTags Purpose Removes sections of input delimited by start and end tags (such as html tags). Source Code ##################################################################### # SCRIPT: SS_RemoveTags # # This script takes its input from a string variable $input. It then removes # portions of that input that is enclosed within $start_tag and $end_tag. # # The script is typically used to remove tags from a web page to create # a plain text version. Tags are <...>, &...;, etc. The first character # is passed as $start_tag and the last character is passed as $end_tag. # The web page is read into a string variable, which is then passed as # $input to this script. # # Download this script into directory C:/Scripts to a file named sS_RemoveTags.txt. # Then call it as below. # # script "C:/Scripts/SS_RemoveTags.txt" input("some string") start_tag("<") end_tag(">") # # The above will remove <> html tags from input and produce output on screen. # The output can be redirected to a string variable and processed further. # # This script is used by other sample scripts, for example, SS_WebPageToText . # # The script can be edited to meet your requirements more precisely. # # If you don't have biterscripting, you can download it from biterScripting.com . # ##################################################################### # Input variables var str input, start_tag, end_tag # Remove all tags enclosed between start_tag and end_tag. To do this, we will collect text up to # the $start_tag, discard text after that up to $end_tag. We will use a temporary string to # collect intermediate output. var str output, temp_str # Get the first instance of $start_tag. stex -p ("^"+$start_tag+"^") $input > $temp_str while ( $temp_str <> "" ) do # Get portion up to $start_tag, add it to $output. stex ("]^"+$start_tag+"^") $input > $temp_str # $temp_str may be empty. set $output = $output + $temp_str # Is there $end_tag present in the remaining portion ? stex -p ("^"+$end_tag+"^") $input > $temp_str if ( $temp_str <> "" ) do # End tag is present. Remove everything upto it. stex ("^"+$end_tag+"^]") $input > null done else do # End tag is not present. We will discard the rest of $input. set $input = "" done endif # Get the next instance of $start_tag. stex -p ("^"+$start_tag+"^") $input > $temp_str done # There may be something left in $input after the last $end_tag. set $output = $output + $input # We are done. Echo $output. echo $output

2008-2013, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com. Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.