Operators and Keywords

Function List:

C++ API File Reference

#include <algorithm>
#include <sstream>
#include "defun-dld.h"
#include "error.h"
#include "gripes.h"
#include "oct-obj.h"
#include "utils.h"
#include "Cell.h"
#include "oct-map.h"
#include "str-vec.h"
#include "quit.h"
#include "parse.h"
#include "oct-locbuf.h"

Include dependency graph for


class  regexp_elem


#define MAXLOOKBEHIND   10


typedef std::list< regexp_elem >


 DEFUN_DLD (regexp, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{s}, @var{e}, @var{te}, @var{m}, @var{t}, @var{nm}] =} regexp (@var{str}, @var{pat})\n\ @deftypefnx {Loadable Function} {[@dots{}] =} regexp (@var{str}, @var{pat}, @var{opts}, @dots{})\n\ \n\ Regular expression string matching. Matches @var{pat} in @var{str} and\n\ returns the position and matching substrings or empty values if there are\n\ none.\n\ \n\ The matched pattern @var{pat} can include any of the standard regex\n\ operators, including:\n\ \n\ @table @code\n\ @item .\n\ Match any character\n\ @item * + ? @{@}\n\ Repetition operators, representing\n\ @table @code\n\ @item *\n\ Match zero or more times\n\ @item +\n\ Match one or more times\n\ @item ?\n\ Match zero or one times\n\ @item @{@}\n\ Match range operator, which is of the form @code{@{@var{n}@}} to match exactly\n\ @var{n} times, @code{@{@var{m},@}} to match @var{m} or more times,\n\ @code{@{@var{m},@var{n}@}} to match between @var{m} and @var{n} times.\n\ @end table\n\ @item [@dots{}] [^@dots{}]\n\ List operators, where for example @code{[ab]c} matches @code{ac} and @code{bc}\n\ @item ()\n\ Grouping operator\n\ @item |\n\ Alternation operator. Match one of a choice of regular expressions. The\n\ alternatives must be delimited by the grouping operator @code{()} above\n\ @item ^ $\n\ Anchoring operator. @code{^} matches the start of the string @var{str} and\n\ @code{$} the end\n\ @end table\n\ \n\ In addition the following escaped characters have special meaning. It should\n\ be noted that it is recommended to quote @var{pat} in single quotes rather\n\ than double quotes, to avoid the escape sequences being interpreted by Octave\n\ before being passed to @code{regexp}.\n\ \n\ @table @code\n\ @item \\b\n\ Match a word boundary\n\ @item \\B\n\ Match within a word\n\ @item \\w\n\ Matches any word character\n\ @item \\W\n\ Matches any non word character\n\ @item \<\n\ Matches the beginning of a word\n\ @item \>\n\ Matches the end of a word\n\ @item \\s\n\ Matches any whitespace character\n\ @item \\S\n\ Matches any non whitespace character\n\ @item \\d\n\ Matches any digit\n\ @item \\D\n\ Matches any non-digit\n\ @end table\n\ \n\ The outputs of @code{regexp} by default are in the order as given below\n\ \n\ @table @asis\n\ @item @var{s}\n\ The start indices of each of the matching substrings\n\ \n\ @item @var{e}\n\ The end indices of each matching substring\n\ \n\ @item @var{te}\n\ The extents of each of the matched token surrounded by @code{(@dots{})} in\n\ @var{pat}.\n\ \n\ @item @var{m}\n\ A cell array of the text of each match.\n\ \n\ @item @var{t}\n\ A cell array of the text of each token matched.\n\ \n\ @item @var{nm}\n\ A structure containing the text of each matched named token, with the name\n\ being used as the fieldname. A named token is denoted as\n\ @code{(?<name>@dots{})}\n\ @end table\n\ \n\ Particular output arguments or the order of the output arguments can be\n\ selected by additional @var{opts} arguments. These are strings and the\n\ correspondence between the output arguments and the optional argument\n\ are\n\ \n\ @multitable @columnfractions 0.2 0.3 0.3 0.2\n\ @item @tab 'start' @tab @var{s} @tab\n\ @item @tab 'end' @tab @var{e} @tab\n\ @item @tab 'tokenExtents' @tab @var{te} @tab\n\ @item @tab 'match' @tab @var{m} @tab\n\ @item @tab 'tokens' @tab @var{t} @tab\n\ @item @tab 'names' @tab @var{nm} @tab\n\ @end multitable\n\ \n\ A further optional argument is 'once', that limits the number of returned\n\ matches to the first match. Additional arguments are\n\ \n\ @table @asis\n\ @item matchcase\n\ Make the matching case sensitive.\n\ @item ignorecase\n\ Make the matching case insensitive.\n\ @item stringanchors\n\ Match the anchor characters at the beginning and end of the string.\n\ @item lineanchors\n\ Match the anchor characters at the beginning and end of the line.\n\ @item dotall\n\ The character @code{.} matches the newline character.\n\ @item dotexceptnewline\n\ The character @code{.} matches all but the newline character.\n\ @item freespacing\n\ The pattern can include arbitrary whitespace and comments starting with\n\ @code{#}.\n\ @item literalspacing\n\ The pattern is taken literally.\n\ @end table\n\ @seealso{regexpi, regexprep}\n\ @end deftypefn")
 DEFUN_DLD (regexpi, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{s}, @var{e}, @var{te}, @var{m}, @var{t}, @var{nm}] =} regexpi (@var{str}, @var{pat})\n\ @deftypefnx {Loadable Function} {[@dots{}] =} regexpi (@var{str}, @var{pat}, @var{opts}, @dots{})\n\ \n\ Case insensitive regular expression string matching. Matches @var{pat} in\n\ @var{str} and returns the position and matching substrings or empty values\n\ if there are none. @xref{doc-regexp,,regexp}, for more details\n\ @end deftypefn")
 DEFUN_DLD (regexprep, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{string} =} regexprep (@var{string}, @var{pat}, @var{repstr}, @var{options})\n\ Replace matches of @var{pat} in @var{string} with @var{repstr}.\n\ \n\ \n\ The replacement can contain @code{$i}, which substitutes\n\ for the ith set of parentheses in the match string. E.g.,\n\ @example\n\ @group\n\ \n\ regexprep(\"Bill Dunn\",'(\\w+) (\\w+)','$2, $1')\n\ \n\ @end group\n\ @end example\n\ returns \"Dunn, Bill\"\n\ \n\ @var{options} may be zero or more of\n\ @table @samp\n\ \n\ @item once\n\ Replace only the first occurrence of @var{pat} in the result.\n\ \n\ @item warnings\n\ This option is present for compatibility but is ignored.\n\ \n\ @item ignorecase or matchcase\n\ Ignore case for the pattern matching (see @code{regexpi}).\n\ Alternatively, use (?i) or (?-i) in the pattern.\n\ \n\ @item lineanchors and stringanchors\n\ Whether characters ^ and $ match the beginning and ending of lines.\n\ Alternatively, use (?m) or (?-m) in the pattern.\n\ \n\ @item dotexceptnewline and dotall\n\ Whether . matches newlines in the string.\n\ Alternatively, use (?s) or (?-s) in the pattern.\n\ \n\ @item freespacing or literalspacing\n\ Whether whitespace and # comments can be used to make the regular expression more readable.\n\ Alternatively, use (?x) or (?-x) in the pattern.\n\ \n\ @end table\n\ @seealso{regexp,regexpi,strrep}\n\ @end deftypefn")

Define Documentation

#define MAXLOOKBEHIND   10


Typedef Documentation

Function Documentation

DEFUN_DLD ( regexprep  ,

DEFUN_DLD ( regexpi  ,
args  ,

DEFUN_DLD ( regexp  ,
args  ,