\variable{CASE_SEARCH}
\synopsis{Control the case-sensitivity for searches}
\usage{Int_Type CASE_SEARCH}
\description
 If the value of \var{CASE_SEARCH} is non-zero, text searches will be
 case-sensitive, otherwise case-insensitive searches will be performed.
\seealso{fsearch, ffind}
\done

\function{bfind}
\synopsis{bfind}
\usage{Integer bfind (String str);}
\description
  \var{bfind} searches backward from the current position to the beginning
  of the line for the string \var{str}.  If a match is found, the length of
  \var{str} is returned and the current point is moved to the start of the
  match. If no match is found, zero is returned.
  Note: This function respects the setting of the \var{CASE_SEARCH} variable.
\seealso{bsearch, ffind, bol_bsearch, re_bsearch}
\seealso{CASE_SEARCH}
\done

\function{bfind_char}
\synopsis{bfind_char}
\usage{Integer fsearch_char (Integer ch);}
\description
  This function searches backward on the current line for a character
  \var{ch}.  If it is found, \var{1} is returned; otherwise \exmp{0} is returned.
\seealso{fsearch_char, ffind_char, fsearch}
\seealso{CASE_SEARCH}
\done

\function{bol_bsearch}
\synopsis{bol_bsearch}
\usage{Integer bol_bsearch (str);}
\description
  \var{bol_bsearch} searches backward from the current point until the
  beginning of the buffer for the occurrences of the string \var{str} at
  the beginning of a line.  If a match is found, the length of \var{str} is
  returned and the current point is moved to the start of the match. If
  no match is found, zero is returned.

  Note: \var{bol_bsearch} is much faster than using \var{re_bsearch} to perform
  a search that matches the beginning of a line.
\seealso{bol_fsearch, bsearch, bfind, re_bsearch}
\seealso{CASE_SEARCH}
\done

\function{bol_bsearch_char}
\synopsis{bol_bsearch_char}
\usage{Integer bol_fsearch_char (Integer ch);}
\description
  This function searches backward for a character \var{ch} at the beginning
  of a line.  If it is found, \var{1} is returned; otherwise \exmp{0} is returned.
\seealso{bol_bsearch, bol_fsearch_char, bsearch_char}
\seealso{CASE_SEARCH}
\done

\function{bol_fsearch}
\synopsis{bol_fsearch}
\usage{Integer bol_fsearch (str);}
\description
  \var{bol_fsearch} searches forward from the current point until the end
  of the buffer for occurrences of the string \var{str} at the beginning of
  a line.  If a match is found, the length of \var{str} is returned and the
  current point is moved to the start of the match.  If no match is
  found, zero is returned.
  Note: \var{bol_fsearch} is much faster than using \var{re_fsearch} to perform
  a search that matches the beginning of a line.
\seealso{bol_bsearch, fsearch, ffind, re_fsearch}
\seealso{CASE_SEARCH}
\done

\function{bol_fsearch_char}
\synopsis{bol_fsearch_char}
\usage{Integer bol_fsearch_char (Integer ch);}
\description
  This function searches forward for a character \var{ch} at the beginning
  of a line.  If it is found, \var{1} is returned; otherwise \exmp{0} is returned.
\seealso{bol_fsearch, bol_bsearch_char, fsearch_char}
\seealso{CASE_SEARCH}
\done

\function{bsearch}
\synopsis{bsearch}
\usage{Integer bsearch (String str);}
\description
  The \var{bsearch} function searches backward from the current position
  for the string \var{str}.  If \var{str} is found, this function will return
  the length of \var{str} and move the current position to the beginning of
  the matched text.  If a match is not found, zero will be returned and
  the position will not change.  It respects the value of the variable
  \var{CASE_SEARCH}.
\seealso{fsearch, bol_bsearch, re_bsearch}
\done

\function{bsearch_char}
\synopsis{bsearch_char}
\usage{Integer fsearch_char (Integer ch);}
\description
  This function searches backward for a character \var{ch}.  If it is
  found, \var{1} is returned; otherwise \exmp{0} is returned.
\seealso{fsearch_char, ffind_char, fsearch}
\seealso{CASE_SEARCH}
\done

\function{ffind}
\synopsis{ffind}
\usage{Integer ffind (String s);}
\description
  \var{ffind} searches forward from the current position to the end of the
  line for the string \var{str}.  If a match is found, the length of \var{str}
  is returned and the current point is moved to the start of the match.
  If no match is found, zero is returned.
  Note: This function respects the setting of the \var{CASE_SEARCH} variable.
  To perform a search that includes multiple lines, use the \var{fsearch}
  function.
\seealso{fsearch, bfind, re_fsearch, bol_fsearch}
\done

\function{ffind_char}
\synopsis{ffind_char}
\usage{Integer fsearch_char (Integer ch);}
\description
  This function searches forwardward on the current line for a character
  \var{ch}.  If it is found, \var{1} is returned; otherwise \exmp{0} is returned.
\seealso{fsearch_char, bfind_char, fsearch}
\seealso{CASE_SEARCH}
\done

\function{find_matching_delimiter}
\synopsis{find_matching_delimiter}
\usage{Integer find_matching_delimiter (Integer ch);}
\description
  This function scans either forward or backward looking for the
  delimiter that matches the character specified by \var{ch}.  The actual
  direction depends upon the syntax of the character \var{ch}.  The
  matching delimiter pair must be declared as such by a prior call to
  \var{define_syntax}.  This function returns one of the following values:
#v+
         1    Match found
         0    Match not found
        -1    A match was attempted from within a string.
        -2    A match was attempted from within a comment
         2    No information
#v-
  In addition, the current point is left either at the match or is left
  at the place where the routine either detected a mismatch or gave up.
  In the case of a comment or a string (return values of -2 or -1), the
  current point is left at the beginning of a comment.
  Note: If the of \var{ch} is zero, the character at the current point will be
  used.
\seealso{blink_match, create_syntax_table, define_syntax, parse_to_point}
\done

\function{fsearch}
\synopsis{fsearch}
\usage{Integer fsearch (String str);}
\description
  This function may be used to search forward in buffer looking for the
  string \var{str}.  If not found, this functions returns zero.  However,
  if found, the length of the string is returned and the current point
  is moved to the to the start of the match.  It respects the setting
  of the variable \var{CASE_SEARCH}.  If the string that one is searching
  for is known to be at the beginning of a line, the function
  \var{bol_fsearch} should be used instead.

  Note: This function cannot find a match that crosses lines.
\seealso{ffind, fsearch_char, bsearch, bol_fsearch, re_fsearch, looking_at}
\seealso{CASE_SEARCH}
\done

\function{fsearch_char}
\synopsis{fsearch_char}
\usage{Integer fsearch_char (Integer ch);}
\description
  This function searches forward for a character \var{ch}.  If it is
  found, \var{1} is returned; otherwise \exmp{0} is returned.
\seealso{fsearch, ffind_char, bsearch_char}
\seealso{CASE_SEARCH}
\done

\function{looking_at}
\synopsis{looking_at}
\usage{Integer looking_at (String s);}
\description
  This function returns non-zero if the characters immediately following
  the current editing point match the string specified by \var{s}.  Whether
  the match is case-sensitive or not depends upon the value of the
  variable \var{CASE_SEARCH}.  The function returns zero if there is no match.
\seealso{ffind, fsearch, re_fsearch, bfind}
\done

\function{re_bsearch}
\synopsis{re_bsearch}
\usage{Integer re_bsearch(String pattern);}
\description
  Search backward for regular expression \var{pattern}.  This function returns
  the 1 + length of the string  matched.  If no match is found, it returns
  0.
\seealso{bsearch, bol_bsearch, re_fsearch}
\done

\function{re_fsearch}
\synopsis{re_fsearch}
\usage{Integer re_fsearch(String pattern);}
\description
  Search forward for regular expression \var{pattern}.  This function returns
  the 1 + length of the string  matched.  If no match is found, it returns
  0.
\seealso{fsearch, bol_fsearch, re_bsearch}
\done

\function{regexp_nth_match}
\synopsis{regexp_nth_match}
\usage{String regexp_nth_match (Integer n);}
\description
  This function returns the nth sub-expression matched by the last regular
  expression search.  If the parameter \var{n} is zero, the entire match is
  returned.
  Note: The value returned by this function is meaningful only if the
  editing point has not been moved since the match.
\seealso{re_fsearch, re_bsearch}
\done

\function{replace}
\synopsis{replace}
\usage{Void replace(String old, String new);}
\description
  This function may be used to replace all occurances of the string
  \var{old} with the string, \var{new}, from current editing point to the end
  of the buffer. The editing point is returned to the initial location.
  That is, this function does not move the editing point.
\seealso{replace_chars, fsearch, re_fsearch, bsearch, ffind, del}
\seealso{REPLACE_PRESERVE_CASE}
\done

\function{replace_chars}
\synopsis{replace_chars}
\usage{Void replace_chars (Integer n, String new);}
\description
  This function may be used to replace the next \var{n} characters at the
  editing position by the string \var{new}.  After the replacement, the editing
  point will be moved to the end of the inserted string.  The length of
  the replacement string \var{new} is returned.
\seealso{fsearch, re_fsearch, bsearch, ffind, del}
\seealso{REPLACE_PRESERVE_CASE}
\done

\function{replace_match}
\synopsis{replace_match}
\usage{Integer replace_match(String s, Integer how);}
\description
  This function replaces text previously matched with \var{re_fsearch} or
  \var{re_bsearch} at the current editing point with string \var{s}.  If \var{how} is
  zero, \var{s} is a specially formatted string of the form described below.
  If \var{how} is non-zero, \var{s} is regarded as a simple string and is used
  literally.  If the replacement fails, this function returns zero
  otherwise, it returns non-zero.
\done

\function{search_file}
\synopsis{search_file}
\usage{Integer search_file (String filename, String re, Integer nmax);}
\description
  This function may be used to search for strings in a disk file
  matching the regular expression \var{re}.  The first argument \var{filename}
  specifies which file to search.  The last argument \var{nmax} specifies
  how many matches to return.  Each line that is matched is pushed onto
  the S-Lang stack.  The number of matches (limited by \var{nmax}) is returned.
  If the file contains no matches, zero is returned.
\done

