aboutsummaryrefslogtreecommitdiff
path: root/man/man3/regexp.html
diff options
context:
space:
mode:
Diffstat (limited to 'man/man3/regexp.html')
-rw-r--r--man/man3/regexp.html178
1 files changed, 178 insertions, 0 deletions
diff --git a/man/man3/regexp.html b/man/man3/regexp.html
new file mode 100644
index 00000000..21e1849b
--- /dev/null
+++ b/man/man3/regexp.html
@@ -0,0 +1,178 @@
+<head>
+<title>regexp(3) - Plan 9 from User Space</title>
+<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
+</head>
+<body bgcolor=#ffffff>
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=10><td>
+<tr><td width=20><td>
+<tr><td width=20><td><b>REGEXP(3)</b><td align=right><b>REGEXP(3)</b>
+<tr><td width=20><td colspan=2>
+ <br>
+<p><font size=+1><b>NAME </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ regcomp, regcomplit, regcompnl, regexec, regsub, rregexec, rregsub,
+ regerror &ndash; regular expression<br>
+
+</table>
+<p><font size=+1><b>SYNOPSIS </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>#include &lt;u.h&gt;<br>
+ #include &lt;libc.h&gt;<br>
+ #include &lt;regexp.h&gt;
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>Reprog &nbsp;&nbsp;&nbsp;*regcomp(char *exp)
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>Reprog &nbsp;&nbsp;&nbsp;*regcomplit(char *exp)
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>Reprog &nbsp;&nbsp;&nbsp;*regcompnl(char *exp)
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>int &nbsp;&nbsp;&nbsp;regexec(Reprog *prog, char *string, Resub *match, int msize)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>void regsub(char *source, char *dest, int dlen, Resub *match,
+ int msize)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>int &nbsp;&nbsp;&nbsp;rregexec(Reprog *prog, Rune *string, Resub *match, int msize)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>void rregsub(Rune *source, Rune *dest, int dlen, Resub *match,
+ int msize)<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+ <tt><font size=+1>void regerror(char *msg)<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>DESCRIPTION </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <i>Regcomp</i> compiles a regular expression and returns a pointer to
+ the generated description. The space is allocated by <a href="../man3/malloc.html"><i>malloc</i>(3)</a>
+ and may be released by <i>free</i>. Regular expressions are exactly as
+ in <a href="../man7/regexp.html"><i>regexp</i>(7)</a>.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Regcomplit</i> is like <i>regcomp</i> except that all characters are treated
+ literally. <i>Regcompnl</i> is like <i>regcomp</i> except that the <tt><font size=+1>.</font></tt> metacharacter
+ matches all characters, including newlines.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Regexec</i> matches a null-terminated <i>string</i> against the compiled
+ regular expression in <i>prog</i>. If it matches, <i>regexec</i> returns <tt><font size=+1>1</font></tt> and
+ fills in the array <i>match</i> with character pointers to the substrings
+ of <i>string</i> that correspond to the parenthesized subexpressions
+ of <i>exp</i>: <tt><font size=+1>match[</font></tt><i>i</i><tt><font size=+1>].sp</font></tt> points to the beginning and
+ <tt><font size=+1>match[</font></tt><i>i</i><tt><font size=+1>].ep</font></tt> points just beyond the end of the <i>i</i>th substring. (Subexpression
+ <i>i</i> begins at the <i>i</i>th left parenthesis, counting from 1.) Pointers
+ in <tt><font size=+1>match[0]</font></tt> pick out the substring that corresponds to the whole
+ regular expression. Unused elements of <i>match</i> are filled with zeros.
+ Matches involving <tt><font size=+1>*</font></tt>, <tt><font size=+1>+</font></tt>, and <tt><font size=+1>?</font></tt> are
+ extended as far as possible. The number of array elements in <i>match</i>
+ is given by <i>msize</i>. The structure of elements of <i>match</i> is:<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>typedef struct {<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ union {<br>
+ char *sp;<br>
+ Rune *rsp;<br>
+ } s;<br>
+ union {<br>
+ char *ep;<br>
+ Rune *rep;<br>
+ } e;<br>
+
+ </table>
+ } Resub;<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+
+ </table>
+ If <tt><font size=+1>match[0].s.sp</font></tt> is nonzero on entry, <i>regexec</i> starts matching
+ at that point within <i>string</i>. If <tt><font size=+1>match[0].e.ep</font></tt> is nonzero on entry,
+ the last character matched is the one preceding that point.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Regsub</i> places in <i>dest</i> a substitution instance of <i>source</i> in the
+ context of the last <i>regexec</i> performed using <i>match</i>. Each instance
+ of <tt><font size=+1>\</font></tt><i>n</i>, where <i>n</i> is a digit, is replaced by the string delimited
+ by <tt><font size=+1>match[</font></tt><i>n</i><tt><font size=+1>].sp</font></tt> and <tt><font size=+1>match[</font></tt><i>n</i><tt><font size=+1>].ep</font></tt>. Each instance of <tt><font size=+1>&amp;</font></tt> is replaced
+ by the string delimited by <tt><font size=+1>match[0].sp</font></tt> and
+ <tt><font size=+1>match[0].ep</font></tt>. The substitution will always be null terminated and
+ trimmed to fit into dlen bytes.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Regerror</i>, called whenever an error is detected in <i>regcomp</i>, writes
+ the string <i>msg</i> on the standard error file and exits. <i>Regerror</i>
+ can be replaced to perform special error processing. If the user
+ supplied <i>regerror</i> returns rather than exits, <i>regcomp</i> will return
+ 0.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ <i>Rregexec</i> and <i>rregsub</i> are variants of <i>regexec</i> and <i>regsub</i> that use
+ strings of <tt><font size=+1>Runes</font></tt> instead of strings of <tt><font size=+1>chars</font></tt>. With these routines,
+ the <i>rsp</i> and <i>rep</i> fields of the <i>match</i> array elements should be used.<br>
+
+</table>
+<p><font size=+1><b>SOURCE </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>/usr/local/plan9/src/libregexp<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>SEE ALSO </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <a href="../man1/grep.html"><i>grep</i>(1)</a><br>
+
+</table>
+<p><font size=+1><b>DIAGNOSTICS </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <i>Regcomp</i> returns <tt><font size=+1>0</font></tt> for an illegal expression or other failure.
+ <i>Regexec</i> returns 0 if <i>string</i> is not matched.<br>
+
+</table>
+<p><font size=+1><b>BUGS </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ There is no way to specify or match a NUL character; NULs terminate
+ patterns and strings.<br>
+
+</table>
+
+<td width=20>
+<tr height=20><td>
+</table>
+<!-- TRAILER -->
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=15><td width=10><td><td width=10>
+<tr><td><td>
+<center>
+<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
+</center>
+</table>
+<!-- TRAILER -->
+</body></html>