Skip to content.

Find topic

Web tools

Help

Tools

       Analysis Tool Bar  +

Pattern Match -- Raw Grep

See http://taporware.mcmaster.ca/~taporware/otherTools/grep.shtml

Description

This tool can find string anywhere in a text document. If the string is part of a word or part of a non-space string, the word or the non-space string will be displayed as a unit. The search can also be used to view a concordance of either words, sentences, or lines surrounding the result.

Note: This tool will treat either XML or HTML text as plain text. So your search pattern/string can contain < and >.

History

  • Created by Lian Yan in 2006.

Pseudocode

  • Obtain source text string by URL or from user's local disk
  • Find user specified string along with user specified context -- concordance
  • Generate output of concordance and/or word lists before and after the user specified word/pattern in the concordance text

Ways of Using

  • Enter a valid URL in the URL field or enter a local path upload the source text
  • Enter a string in the corresponding text field
  • Select the context of concordance and enter a integer as the length of context
  • Select output format
  • If you want to display the word lists before and after the word/pattern, check the "Display words before and after the pattern" box. this is for HTML format only
  • If you want the results displayed in the same window with taporware interface, uncheck the check box - "Open results in new window"
  • Finally, click the "Submit" button

CGI Interface

If you want to use this tool from your web site, here is the CGI Interface: (Note: If you want to upload local source text to the tool, you need to use attribute name/value pair: enctype="multipart/form-data" within the form tag)

Here are the parameters:

Parameter Name Parameter Value Control Type Default Discription
source url/local radio button url Let user select input text (either a url or upload local html text)
texturl   text   A Valid URL that pointed plain text, html, or xml text
localFile   file   The path to your local source text file
find_pattern   text   word/pattern of the concordance
context Word/Line/ Sentence/paragraph selection Word context type
contLength   text 5 context length corresponding to the selected context
HowToList 1/2/3 selection 2 Display format which are HTML/XML text in HTML/XML tree in the order of parameter values
beforeafter   checkbox unchecked Indicate if the word list before and after the key word/pattern be displayed
taporface   checkbox checked display result in a new window without graphics interface (default) or with taporware interface in the same window

Use Raw Grep TAPoRware Tool in Your Web Page

You can add a text field and a button in your web page to find the string you specified and its related text in that page by call TAPoRware cgi script.

String:   

Here is the code for the interface above:

<form method="post" name="textForm" enctype="multipart/form-data" target="_blank" action="http://taporware.mcmaster.ca/~taporware/cgi-bin/prototype/tgrep.cgi" onsubmit="document.textForm.texturl.value=document.location.href">

<input type="hidden" name="source" value="url" />

<input type="hidden" name="texturl" />

<input type="hidden" name="freetext" value="Y"/>

String: <input type="text" name="find_pattern" />  

<input type="hidden" name="context" value="Word" />

<input type="hidden" name="contLength" value="5" />

<input type="hidden" name="HowToList" value="1" />

<input type="submit" name="doit" value="Grep" >

</form>

-- LianYan - 31 May 2007


Use this box to quickly add a comment to the page.

more options...