mirror of https://github.com/matrix-org/go-neb.git
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							1500 lines
						
					
					
						
							54 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							1500 lines
						
					
					
						
							54 KiB
						
					
					
				
								<!DOCTYPE html>
							 | 
						|
								<html>
							 | 
						|
								<head>
							 | 
						|
								<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
							 | 
						|
								<meta name="viewport" content="width=device-width, initial-scale=1">
							 | 
						|
								<meta name="theme-color" content="#375EAB">
							 | 
						|
								
							 | 
						|
								  <title>regexp - The Go Programming Language</title>
							 | 
						|
								
							 | 
						|
								<link type="text/css" rel="stylesheet" href="../../lib/godoc/style.css">
							 | 
						|
								
							 | 
						|
								<link rel="stylesheet" href="../../lib/godoc/jquery.treeview.css">
							 | 
						|
								<script type="text/javascript">window.initFuncs = [];</script>
							 | 
						|
								</head>
							 | 
						|
								<body>
							 | 
						|
								
							 | 
						|
								<div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
							 | 
						|
								...
							 | 
						|
								</div><!-- #lowframe -->
							 | 
						|
								
							 | 
						|
								<div id="topbar" class="wide"><div class="container">
							 | 
						|
								<div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
							 | 
						|
								<div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
							 | 
						|
								<a href="index.html#" id="menu-button"><span id="menu-button-arrow">▽</span></a>
							 | 
						|
								<form method="GET" action="http://localhost:6060/search">
							 | 
						|
								<div id="menu">
							 | 
						|
								<a href="http://localhost:6060/doc/">Documents</a>
							 | 
						|
								<a href="http://localhost:6060/pkg/">Packages</a>
							 | 
						|
								<a href="http://localhost:6060/project/">The Project</a>
							 | 
						|
								<a href="http://localhost:6060/help/">Help</a>
							 | 
						|
								<a href="http://localhost:6060/blog/">Blog</a>
							 | 
						|
								
							 | 
						|
								<input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
							 | 
						|
								</div>
							 | 
						|
								</form>
							 | 
						|
								
							 | 
						|
								</div></div>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								<div id="page" class="wide">
							 | 
						|
								<div class="container">
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								  <h1>Package regexp</h1>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								<div id="nav"></div>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								<!--
							 | 
						|
									Copyright 2009 The Go Authors. All rights reserved.
							 | 
						|
									Use of this source code is governed by a BSD-style
							 | 
						|
									license that can be found in the LICENSE file.
							 | 
						|
								-->
							 | 
						|
								<!--
							 | 
						|
									Note: Static (i.e., not template-generated) href and id
							 | 
						|
									attributes start with "pkg-" to make it impossible for
							 | 
						|
									them to conflict with generated attributes (some of which
							 | 
						|
									correspond to Go identifiers).
							 | 
						|
								-->
							 | 
						|
								
							 | 
						|
									<script type='text/javascript'>
							 | 
						|
									document.ANALYSIS_DATA = null;
							 | 
						|
									document.CALLGRAPH = null;
							 | 
						|
									</script>
							 | 
						|
								
							 | 
						|
									
							 | 
						|
										
							 | 
						|
										<div id="short-nav">
							 | 
						|
											<dl>
							 | 
						|
											<dd><code>import "regexp"</code></dd>
							 | 
						|
											</dl>
							 | 
						|
											<dl>
							 | 
						|
											<dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
							 | 
						|
											<dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
							 | 
						|
											
							 | 
						|
												<dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd>
							 | 
						|
											
							 | 
						|
											
							 | 
						|
												<dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd>
							 | 
						|
											
							 | 
						|
											</dl>
							 | 
						|
										</div>
							 | 
						|
										<!-- The package's Name is printed as title by the top-level template -->
							 | 
						|
										<div id="pkg-overview" class="toggleVisible">
							 | 
						|
											<div class="collapsed">
							 | 
						|
												<h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
							 | 
						|
											</div>
							 | 
						|
											<div class="expanded">
							 | 
						|
												<h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
							 | 
						|
												<p>
							 | 
						|
								Package regexp implements regular expression search.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								The syntax of the regular expressions accepted is the same
							 | 
						|
								general syntax used by Perl, Python, and other languages.
							 | 
						|
								More precisely, it is the syntax accepted by RE2 and described at
							 | 
						|
								<a href="https://golang.org/s/re2syntax">https://golang.org/s/re2syntax</a>, except for \C.
							 | 
						|
								For an overview of the syntax, run
							 | 
						|
								</p>
							 | 
						|
								<pre>go doc regexp/syntax
							 | 
						|
								</pre>
							 | 
						|
								<p>
							 | 
						|
								The regexp implementation provided by this package is
							 | 
						|
								guaranteed to run in time linear in the size of the input.
							 | 
						|
								(This is a property not guaranteed by most open source
							 | 
						|
								implementations of regular expressions.) For more information
							 | 
						|
								about this property, see
							 | 
						|
								</p>
							 | 
						|
								<pre><a href="http://swtch.com/~rsc/regexp/regexp1.html">http://swtch.com/~rsc/regexp/regexp1.html</a>
							 | 
						|
								</pre>
							 | 
						|
								<p>
							 | 
						|
								or any book about automata theory.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								All characters are UTF-8-encoded code points.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								There are 16 methods of Regexp that match a regular expression and identify
							 | 
						|
								the matched text.  Their names are matched by this regular expression:
							 | 
						|
								</p>
							 | 
						|
								<pre>Find(All)?(String)?(Submatch)?(Index)?
							 | 
						|
								</pre>
							 | 
						|
								<p>
							 | 
						|
								If 'All' is present, the routine matches successive non-overlapping
							 | 
						|
								matches of the entire expression.  Empty matches abutting a preceding
							 | 
						|
								match are ignored.  The return value is a slice containing the successive
							 | 
						|
								return values of the corresponding non-'All' routine.  These routines take
							 | 
						|
								an extra integer argument, n; if n >= 0, the function returns at most n
							 | 
						|
								matches/submatches.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								If 'String' is present, the argument is a string; otherwise it is a slice
							 | 
						|
								of bytes; return values are adjusted as appropriate.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								If 'Submatch' is present, the return value is a slice identifying the
							 | 
						|
								successive submatches of the expression. Submatches are matches of
							 | 
						|
								parenthesized subexpressions (also known as capturing groups) within the
							 | 
						|
								regular expression, numbered from left to right in order of opening
							 | 
						|
								parenthesis. Submatch 0 is the match of the entire expression, submatch 1
							 | 
						|
								the match of the first parenthesized subexpression, and so on.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								If 'Index' is present, matches and submatches are identified by byte index
							 | 
						|
								pairs within the input string: result[2*n:2*n+1] identifies the indexes of
							 | 
						|
								the nth submatch.  The pair for n==0 identifies the match of the entire
							 | 
						|
								expression.  If 'Index' is not present, the match is identified by the
							 | 
						|
								text of the match/submatch.  If an index is negative, it means that
							 | 
						|
								subexpression did not match any string in the input.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								There is also a subset of the methods that can be applied to text read
							 | 
						|
								from a RuneReader:
							 | 
						|
								</p>
							 | 
						|
								<pre>MatchReader, FindReaderIndex, FindReaderSubmatchIndex
							 | 
						|
								</pre>
							 | 
						|
								<p>
							 | 
						|
								This set may grow.  Note that regular expression matches may need to
							 | 
						|
								examine text beyond the text returned by a match, so the methods that
							 | 
						|
								match text from a RuneReader may read arbitrarily far into the input
							 | 
						|
								before returning.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								(There are a few other methods that do not match this pattern.)
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
											</div>
							 | 
						|
										</div>
							 | 
						|
										<div id="example_" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code"><span class="comment">// Compile the expression once, usually at init time.</span>
							 | 
						|
								<span class="comment">// Use raw strings to avoid having to quote the backslashes.</span>
							 | 
						|
								var validID = regexp.MustCompile(`^[a-z]+\[[0-9]+\]$`)
							 | 
						|
								
							 | 
						|
								fmt.Println(validID.MatchString("adam[23]"))
							 | 
						|
								fmt.Println(validID.MatchString("eve[7]"))
							 | 
						|
								fmt.Println(validID.MatchString("Job[48]"))
							 | 
						|
								fmt.Println(validID.MatchString("snakey"))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">true
							 | 
						|
								true
							 | 
						|
								false
							 | 
						|
								false
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
										<div id="pkg-index" class="toggleVisible">
							 | 
						|
										<div class="collapsed">
							 | 
						|
											<h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
							 | 
						|
										</div>
							 | 
						|
										<div class="expanded">
							 | 
						|
											<h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
							 | 
						|
								
							 | 
						|
										<!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
							 | 
						|
											<div id="manual-nav">
							 | 
						|
											<dl>
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<dd><a href="index.html#Match">func Match(pattern string, b []byte) (matched bool, err error)</a></dd>
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<dd><a href="index.html#MatchReader">func MatchReader(pattern string, r io.RuneReader) (matched bool, err error)</a></dd>
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<dd><a href="index.html#MatchString">func MatchString(pattern string, s string) (matched bool, err error)</a></dd>
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<dd><a href="index.html#QuoteMeta">func QuoteMeta(s string) string</a></dd>
							 | 
						|
											
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<dd><a href="index.html#Regexp">type Regexp</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Compile">func Compile(expr string) (*Regexp, error)</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#CompilePOSIX">func CompilePOSIX(expr string) (*Regexp, error)</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#MustCompile">func MustCompile(str string) *Regexp</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#MustCompilePOSIX">func MustCompilePOSIX(str string) *Regexp</a></dd>
							 | 
						|
												
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.Copy">func (re *Regexp) Copy() *Regexp</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.Expand">func (re *Regexp) Expand(dst []byte, template []byte, src []byte, match []int) []byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.ExpandString">func (re *Regexp) ExpandString(dst []byte, template string, src string, match []int) []byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.Find">func (re *Regexp) Find(b []byte) []byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAll">func (re *Regexp) FindAll(b []byte, n int) [][]byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAllIndex">func (re *Regexp) FindAllIndex(b []byte, n int) [][]int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAllString">func (re *Regexp) FindAllString(s string, n int) []string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAllStringIndex">func (re *Regexp) FindAllStringIndex(s string, n int) [][]int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAllStringSubmatch">func (re *Regexp) FindAllStringSubmatch(s string, n int) [][]string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAllStringSubmatchIndex">func (re *Regexp) FindAllStringSubmatchIndex(s string, n int) [][]int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAllSubmatch">func (re *Regexp) FindAllSubmatch(b []byte, n int) [][][]byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindAllSubmatchIndex">func (re *Regexp) FindAllSubmatchIndex(b []byte, n int) [][]int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindIndex">func (re *Regexp) FindIndex(b []byte) (loc []int)</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindReaderIndex">func (re *Regexp) FindReaderIndex(r io.RuneReader) (loc []int)</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindReaderSubmatchIndex">func (re *Regexp) FindReaderSubmatchIndex(r io.RuneReader) []int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindString">func (re *Regexp) FindString(s string) string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindStringIndex">func (re *Regexp) FindStringIndex(s string) (loc []int)</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindStringSubmatch">func (re *Regexp) FindStringSubmatch(s string) []string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindStringSubmatchIndex">func (re *Regexp) FindStringSubmatchIndex(s string) []int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindSubmatch">func (re *Regexp) FindSubmatch(b []byte) [][]byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.FindSubmatchIndex">func (re *Regexp) FindSubmatchIndex(b []byte) []int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.LiteralPrefix">func (re *Regexp) LiteralPrefix() (prefix string, complete bool)</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.Longest">func (re *Regexp) Longest()</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.Match">func (re *Regexp) Match(b []byte) bool</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.MatchReader">func (re *Regexp) MatchReader(r io.RuneReader) bool</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.MatchString">func (re *Regexp) MatchString(s string) bool</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.NumSubexp">func (re *Regexp) NumSubexp() int</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.ReplaceAll">func (re *Regexp) ReplaceAll(src, repl []byte) []byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.ReplaceAllFunc">func (re *Regexp) ReplaceAllFunc(src []byte, repl func([]byte) []byte) []byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.ReplaceAllLiteral">func (re *Regexp) ReplaceAllLiteral(src, repl []byte) []byte</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.ReplaceAllLiteralString">func (re *Regexp) ReplaceAllLiteralString(src, repl string) string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.ReplaceAllString">func (re *Regexp) ReplaceAllString(src, repl string) string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.ReplaceAllStringFunc">func (re *Regexp) ReplaceAllStringFunc(src string, repl func(string) string) string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.Split">func (re *Regexp) Split(s string, n int) []string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.String">func (re *Regexp) String() string</a></dd>
							 | 
						|
												
							 | 
						|
													
							 | 
						|
													<dd>    <a href="index.html#Regexp.SubexpNames">func (re *Regexp) SubexpNames() []string</a></dd>
							 | 
						|
												
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											</dl>
							 | 
						|
											</div><!-- #manual-nav -->
							 | 
						|
								
							 | 
						|
										
							 | 
						|
										<div id="pkg-examples">
							 | 
						|
											<h4>Examples</h4>
							 | 
						|
											<dl>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_">Package</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_MatchString">MatchString</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_FindAllString">Regexp.FindAllString</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_FindAllStringSubmatch">Regexp.FindAllStringSubmatch</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_FindAllStringSubmatchIndex">Regexp.FindAllStringSubmatchIndex</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_FindString">Regexp.FindString</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_FindStringIndex">Regexp.FindStringIndex</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_FindStringSubmatch">Regexp.FindStringSubmatch</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_ReplaceAllLiteralString">Regexp.ReplaceAllLiteralString</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_ReplaceAllString">Regexp.ReplaceAllString</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_Split">Regexp.Split</a></dd>
							 | 
						|
											
							 | 
						|
											<dd><a class="exampleLink" href="index.html#example_Regexp_SubexpNames">Regexp.SubexpNames</a></dd>
							 | 
						|
											
							 | 
						|
											</dl>
							 | 
						|
										</div>
							 | 
						|
										
							 | 
						|
								
							 | 
						|
										
							 | 
						|
											<h4>Package files</h4>
							 | 
						|
											<p>
							 | 
						|
											<span style="font-size:90%">
							 | 
						|
											
							 | 
						|
												<a href="http://localhost:6060/src/regexp/backtrack.go">backtrack.go</a>
							 | 
						|
											
							 | 
						|
												<a href="http://localhost:6060/src/regexp/exec.go">exec.go</a>
							 | 
						|
											
							 | 
						|
												<a href="http://localhost:6060/src/regexp/onepass.go">onepass.go</a>
							 | 
						|
											
							 | 
						|
												<a href="http://localhost:6060/src/regexp/regexp.go">regexp.go</a>
							 | 
						|
											
							 | 
						|
											</span>
							 | 
						|
											</p>
							 | 
						|
										
							 | 
						|
										</div><!-- .expanded -->
							 | 
						|
										</div><!-- #pkg-index -->
							 | 
						|
								
							 | 
						|
										<div id="pkg-callgraph" class="toggle" style="display: none">
							 | 
						|
										<div class="collapsed">
							 | 
						|
											<h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
							 | 
						|
										</div> <!-- .expanded -->
							 | 
						|
										<div class="expanded">
							 | 
						|
											<h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
							 | 
						|
											<p>
							 | 
						|
											  In the call graph viewer below, each node
							 | 
						|
											  is a function belonging to this package
							 | 
						|
											  and its children are the functions it
							 | 
						|
											  calls—perhaps dynamically.
							 | 
						|
											</p>
							 | 
						|
											<p>
							 | 
						|
											  The root nodes are the entry points of the
							 | 
						|
											  package: functions that may be called from
							 | 
						|
											  outside the package.
							 | 
						|
											  There may be non-exported or anonymous
							 | 
						|
											  functions among them if they are called
							 | 
						|
											  dynamically from another package.
							 | 
						|
											</p>
							 | 
						|
											<p>
							 | 
						|
											  Click a node to visit that function's source code.
							 | 
						|
											  From there you can visit its callers by
							 | 
						|
											  clicking its declaring <code>func</code>
							 | 
						|
											  token.
							 | 
						|
											</p>
							 | 
						|
											<p>
							 | 
						|
											  Functions may be omitted if they were
							 | 
						|
											  determined to be unreachable in the
							 | 
						|
											  particular programs or tests that were
							 | 
						|
											  analyzed.
							 | 
						|
											</p>
							 | 
						|
											<!-- Zero means show all package entry points. -->
							 | 
						|
											<ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
							 | 
						|
										</div>
							 | 
						|
										</div> <!-- #pkg-callgraph -->
							 | 
						|
								
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											<h2 id="Match">func <a href="http://localhost:6060/src/regexp/regexp.go?s=13933:13995#L434">Match</a></h2>
							 | 
						|
											<pre>func Match(pattern <a href="../builtin/index.html#string">string</a>, b []<a href="../builtin/index.html#byte">byte</a>) (matched <a href="../builtin/index.html#bool">bool</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
							 | 
						|
											<p>
							 | 
						|
								Match checks whether a textual regular expression
							 | 
						|
								matches a byte slice.  More complicated queries need
							 | 
						|
								to use Compile and the full Regexp interface.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
											
							 | 
						|
											
							 | 
						|
								
							 | 
						|
										
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											<h2 id="MatchReader">func <a href="http://localhost:6060/src/regexp/regexp.go?s=13260:13335#L412">MatchReader</a></h2>
							 | 
						|
											<pre>func MatchReader(pattern <a href="../builtin/index.html#string">string</a>, r <a href="../io/index.html">io</a>.<a href="../io/index.html#RuneReader">RuneReader</a>) (matched <a href="../builtin/index.html#bool">bool</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
							 | 
						|
											<p>
							 | 
						|
								MatchReader checks whether a textual regular expression matches the text
							 | 
						|
								read by the RuneReader.  More complicated queries need to use Compile and
							 | 
						|
								the full Regexp interface.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
											
							 | 
						|
											
							 | 
						|
								
							 | 
						|
										
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											<h2 id="MatchString">func <a href="http://localhost:6060/src/regexp/regexp.go?s=13601:13669#L423">MatchString</a></h2>
							 | 
						|
											<pre>func MatchString(pattern <a href="../builtin/index.html#string">string</a>, s <a href="../builtin/index.html#string">string</a>) (matched <a href="../builtin/index.html#bool">bool</a>, err <a href="../builtin/index.html#error">error</a>)</pre>
							 | 
						|
											<p>
							 | 
						|
								MatchString checks whether a textual regular expression
							 | 
						|
								matches a string.  More complicated queries need
							 | 
						|
								to use Compile and the full Regexp interface.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
											<div id="example_MatchString" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">matched, err := regexp.MatchString("foo.*", "seafood")
							 | 
						|
								fmt.Println(matched, err)
							 | 
						|
								matched, err = regexp.MatchString("bar.*", "seafood")
							 | 
						|
								fmt.Println(matched, err)
							 | 
						|
								matched, err = regexp.MatchString("a(b", "seafood")
							 | 
						|
								fmt.Println(matched, err)
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">true <nil>
							 | 
						|
								false <nil>
							 | 
						|
								false error parsing regexp: missing closing ): `a(b`
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
											
							 | 
						|
								
							 | 
						|
										
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											<h2 id="QuoteMeta">func <a href="http://localhost:6060/src/regexp/regexp.go?s=18945:18976#L586">QuoteMeta</a></h2>
							 | 
						|
											<pre>func QuoteMeta(s <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
											<p>
							 | 
						|
								QuoteMeta returns a string that quotes all regular expression metacharacters
							 | 
						|
								inside the argument text; the returned string is a regular expression matching
							 | 
						|
								the literal text.  For example, QuoteMeta(`[foo]`) returns `\[foo\]`.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
											
							 | 
						|
											
							 | 
						|
								
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											<h2 id="Regexp">type <a href="http://localhost:6060/src/regexp/regexp.go?s=3279:4028#L72">Regexp</a></h2>
							 | 
						|
											<pre>type Regexp struct {
							 | 
						|
								    <span class="comment">// contains filtered or unexported fields</span>
							 | 
						|
								}</pre>
							 | 
						|
											<p>
							 | 
						|
								Regexp is the representation of a compiled regular expression.
							 | 
						|
								A Regexp is safe for concurrent use by multiple goroutines.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
											
							 | 
						|
								
							 | 
						|
											
							 | 
						|
								
							 | 
						|
											
							 | 
						|
											
							 | 
						|
											
							 | 
						|
								
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Compile">func <a href="http://localhost:6060/src/regexp/regexp.go?s=5016:5058#L118">Compile</a></h3>
							 | 
						|
												<pre>func Compile(expr <a href="../builtin/index.html#string">string</a>) (*<a href="index.html#Regexp">Regexp</a>, <a href="../builtin/index.html#error">error</a>)</pre>
							 | 
						|
												<p>
							 | 
						|
								Compile parses a regular expression and returns, if successful,
							 | 
						|
								a Regexp object that can be used to match against text.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								When matching against text, the regexp returns a match that
							 | 
						|
								begins as early as possible in the input (leftmost), and among those
							 | 
						|
								it chooses the one that a backtracking search would have found first.
							 | 
						|
								This so-called leftmost-first matching is the same semantics
							 | 
						|
								that Perl, Python, and other implementations use, although this
							 | 
						|
								package implements it without the expense of backtracking.
							 | 
						|
								For POSIX leftmost-longest matching, see CompilePOSIX.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="CompilePOSIX">func <a href="http://localhost:6060/src/regexp/regexp.go?s=6177:6224#L141">CompilePOSIX</a></h3>
							 | 
						|
												<pre>func CompilePOSIX(expr <a href="../builtin/index.html#string">string</a>) (*<a href="index.html#Regexp">Regexp</a>, <a href="../builtin/index.html#error">error</a>)</pre>
							 | 
						|
												<p>
							 | 
						|
								CompilePOSIX is like Compile but restricts the regular expression
							 | 
						|
								to POSIX ERE (egrep) syntax and changes the match semantics to
							 | 
						|
								leftmost-longest.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								That is, when matching against text, the regexp returns a match that
							 | 
						|
								begins as early as possible in the input (leftmost), and among those
							 | 
						|
								it chooses a match that is as long as possible.
							 | 
						|
								This so-called leftmost-longest matching is the same semantics
							 | 
						|
								that early regular expression implementations used and that POSIX
							 | 
						|
								specifies.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								However, there can be multiple leftmost-longest matches, with different
							 | 
						|
								submatch choices, and here this package diverges from POSIX.
							 | 
						|
								Among the possible leftmost-longest matches, this package chooses
							 | 
						|
								the one that a backtracking search would have found first, while POSIX
							 | 
						|
								specifies that the match be chosen to maximize the length of the first
							 | 
						|
								subexpression, then the second, and so on from left to right.
							 | 
						|
								The POSIX rule is computationally prohibitive and not even well-defined.
							 | 
						|
								See <a href="http://swtch.com/~rsc/regexp/regexp2.html#posix">http://swtch.com/~rsc/regexp/regexp2.html#posix</a> for details.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="MustCompile">func <a href="http://localhost:6060/src/regexp/regexp.go?s=8419:8455#L219">MustCompile</a></h3>
							 | 
						|
												<pre>func MustCompile(str <a href="../builtin/index.html#string">string</a>) *<a href="index.html#Regexp">Regexp</a></pre>
							 | 
						|
												<p>
							 | 
						|
								MustCompile is like Compile but panics if the expression cannot be parsed.
							 | 
						|
								It simplifies safe initialization of global variables holding compiled regular
							 | 
						|
								expressions.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="MustCompilePOSIX">func <a href="http://localhost:6060/src/regexp/regexp.go?s=8780:8821#L230">MustCompilePOSIX</a></h3>
							 | 
						|
												<pre>func MustCompilePOSIX(str <a href="../builtin/index.html#string">string</a>) *<a href="index.html#Regexp">Regexp</a></pre>
							 | 
						|
												<p>
							 | 
						|
								MustCompilePOSIX is like CompilePOSIX but panics if the expression cannot be parsed.
							 | 
						|
								It simplifies safe initialization of global variables holding compiled regular
							 | 
						|
								expressions.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
								
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.Copy">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=4331:4363#L101">Copy</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) Copy() *<a href="index.html#Regexp">Regexp</a></pre>
							 | 
						|
												<p>
							 | 
						|
								Copy returns a new Regexp object copied from re.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								When using a Regexp in multiple goroutines, giving each goroutine
							 | 
						|
								its own copy helps to avoid lock contention.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.Expand">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=24117:24202#L762">Expand</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) Expand(dst []<a href="../builtin/index.html#byte">byte</a>, template []<a href="../builtin/index.html#byte">byte</a>, src []<a href="../builtin/index.html#byte">byte</a>, match []<a href="../builtin/index.html#int">int</a>) []<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								Expand appends template to dst and returns the result; during the
							 | 
						|
								append, Expand replaces variables in the template with corresponding
							 | 
						|
								matches drawn from src.  The match slice should have been returned by
							 | 
						|
								FindSubmatchIndex.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								In the template, a variable is denoted by a substring of the form
							 | 
						|
								$name or ${name}, where name is a non-empty sequence of letters,
							 | 
						|
								digits, and underscores.  A purely numeric name like $1 refers to
							 | 
						|
								the submatch with the corresponding index; other names refer to
							 | 
						|
								capturing parentheses named with the (?P<name>...) syntax.  A
							 | 
						|
								reference to an out of range or unmatched index or a name that is not
							 | 
						|
								present in the regular expression is replaced with an empty slice.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								In the $name form, name is taken to be as long as possible: $1x is
							 | 
						|
								equivalent to ${1x}, not ${1}x, and, $10 is equivalent to ${10}, not ${1}0.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								To insert a literal $ in the output, use $$ in the template.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.ExpandString">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=24441:24532#L769">ExpandString</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) ExpandString(dst []<a href="../builtin/index.html#byte">byte</a>, template <a href="../builtin/index.html#string">string</a>, src <a href="../builtin/index.html#string">string</a>, match []<a href="../builtin/index.html#int">int</a>) []<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								ExpandString is like Expand but the template and source are strings.
							 | 
						|
								It appends to and returns a byte slice in order to give the calling
							 | 
						|
								code control over allocation.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.Find">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=20801:20840#L668">Find</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) Find(b []<a href="../builtin/index.html#byte">byte</a>) []<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								Find returns a slice holding the text of the leftmost match in b of the regular expression.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAll">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=28946:28997#L925">FindAll</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAll(b []<a href="../builtin/index.html#byte">byte</a>, n <a href="../builtin/index.html#int">int</a>) [][]<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAll is the 'All' version of Find; it returns a slice of all successive
							 | 
						|
								matches of the expression, as defined by the 'All' description in the
							 | 
						|
								package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAllIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=29452:29507#L943">FindAllIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAllIndex(b []<a href="../builtin/index.html#byte">byte</a>, n <a href="../builtin/index.html#int">int</a>) [][]<a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAllIndex is the 'All' version of FindIndex; it returns a slice of all
							 | 
						|
								successive matches of the expression, as defined by the 'All' description
							 | 
						|
								in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAllString">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=29953:30010#L961">FindAllString</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAllString(s <a href="../builtin/index.html#string">string</a>, n <a href="../builtin/index.html#int">int</a>) []<a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAllString is the 'All' version of FindString; it returns a slice of all
							 | 
						|
								successive matches of the expression, as defined by the 'All' description
							 | 
						|
								in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_FindAllString" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("a.")
							 | 
						|
								fmt.Println(re.FindAllString("paranormal", -1))
							 | 
						|
								fmt.Println(re.FindAllString("paranormal", 2))
							 | 
						|
								fmt.Println(re.FindAllString("graal", -1))
							 | 
						|
								fmt.Println(re.FindAllString("none", -1))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">[ar an al]
							 | 
						|
								[ar an]
							 | 
						|
								[aa]
							 | 
						|
								[]
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAllStringIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=30478:30539#L979">FindAllStringIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAllStringIndex(s <a href="../builtin/index.html#string">string</a>, n <a href="../builtin/index.html#int">int</a>) [][]<a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAllStringIndex is the 'All' version of FindStringIndex; it returns a
							 | 
						|
								slice of all successive matches of the expression, as defined by the 'All'
							 | 
						|
								description in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAllStringSubmatch">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=32169:32236#L1039">FindAllStringSubmatch</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAllStringSubmatch(s <a href="../builtin/index.html#string">string</a>, n <a href="../builtin/index.html#int">int</a>) [][]<a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAllStringSubmatch is the 'All' version of FindStringSubmatch; it
							 | 
						|
								returns a slice of all successive matches of the expression, as defined by
							 | 
						|
								the 'All' description in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_FindAllStringSubmatch" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("a(x*)b")
							 | 
						|
								fmt.Printf("%q\n", re.FindAllStringSubmatch("-ab-", -1))
							 | 
						|
								fmt.Printf("%q\n", re.FindAllStringSubmatch("-axxb-", -1))
							 | 
						|
								fmt.Printf("%q\n", re.FindAllStringSubmatch("-ab-axb-", -1))
							 | 
						|
								fmt.Printf("%q\n", re.FindAllStringSubmatch("-axxb-ab-", -1))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">[["ab" ""]]
							 | 
						|
								[["axxb" "xx"]]
							 | 
						|
								[["ab" ""] ["axb" "x"]]
							 | 
						|
								[["axxb" "xx"] ["ab" ""]]
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAllStringSubmatchIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=32850:32919#L1064">FindAllStringSubmatchIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAllStringSubmatchIndex(s <a href="../builtin/index.html#string">string</a>, n <a href="../builtin/index.html#int">int</a>) [][]<a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAllStringSubmatchIndex is the 'All' version of
							 | 
						|
								FindStringSubmatchIndex; it returns a slice of all successive matches of
							 | 
						|
								the expression, as defined by the 'All' description in the package
							 | 
						|
								comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_FindAllStringSubmatchIndex" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("a(x*)b")
							 | 
						|
								<span class="comment">// Indices:</span>
							 | 
						|
								<span class="comment">//    01234567   012345678</span>
							 | 
						|
								<span class="comment">//    -ab-axb-   -axxb-ab-</span>
							 | 
						|
								fmt.Println(re.FindAllStringSubmatchIndex("-ab-", -1))
							 | 
						|
								fmt.Println(re.FindAllStringSubmatchIndex("-axxb-", -1))
							 | 
						|
								fmt.Println(re.FindAllStringSubmatchIndex("-ab-axb-", -1))
							 | 
						|
								fmt.Println(re.FindAllStringSubmatchIndex("-axxb-ab-", -1))
							 | 
						|
								fmt.Println(re.FindAllStringSubmatchIndex("-foo-", -1))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">[[1 3 2 2]]
							 | 
						|
								[[1 5 2 4]]
							 | 
						|
								[[1 3 2 2] [4 7 5 6]]
							 | 
						|
								[[1 5 2 4] [6 8 7 7]]
							 | 
						|
								[]
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAllSubmatch">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=30990:31051#L997">FindAllSubmatch</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAllSubmatch(b []<a href="../builtin/index.html#byte">byte</a>, n <a href="../builtin/index.html#int">int</a>) [][][]<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAllSubmatch is the 'All' version of FindSubmatch; it returns a slice
							 | 
						|
								of all successive matches of the expression, as defined by the 'All'
							 | 
						|
								description in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindAllSubmatchIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=31649:31712#L1021">FindAllSubmatchIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindAllSubmatchIndex(b []<a href="../builtin/index.html#byte">byte</a>, n <a href="../builtin/index.html#int">int</a>) [][]<a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindAllSubmatchIndex is the 'All' version of FindSubmatchIndex; it returns
							 | 
						|
								a slice of all successive matches of the expression, as defined by the
							 | 
						|
								'All' description in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=21157:21206#L680">FindIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindIndex(b []<a href="../builtin/index.html#byte">byte</a>) (loc []<a href="../builtin/index.html#int">int</a>)</pre>
							 | 
						|
												<p>
							 | 
						|
								FindIndex returns a two-element slice of integers defining the location of
							 | 
						|
								the leftmost match in b of the regular expression.  The match itself is at
							 | 
						|
								b[loc[0]:loc[1]].
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindReaderIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=22465:22527#L718">FindReaderIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindReaderIndex(r <a href="../io/index.html">io</a>.<a href="../io/index.html#RuneReader">RuneReader</a>) (loc []<a href="../builtin/index.html#int">int</a>)</pre>
							 | 
						|
												<p>
							 | 
						|
								FindReaderIndex returns a two-element slice of integers defining the
							 | 
						|
								location of the leftmost match of the regular expression in text read from
							 | 
						|
								the RuneReader.  The match text was found in the input stream at
							 | 
						|
								byte offset loc[0] through loc[1]-1.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindReaderSubmatchIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=28517:28581#L915">FindReaderSubmatchIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindReaderSubmatchIndex(r <a href="../io/index.html">io</a>.<a href="../io/index.html#RuneReader">RuneReader</a>) []<a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindReaderSubmatchIndex returns a slice holding the index pairs
							 | 
						|
								identifying the leftmost match of the regular expression of text read by
							 | 
						|
								the RuneReader, and the matches, if any, of its subexpressions, as defined
							 | 
						|
								by the 'Submatch' and 'Index' descriptions in the package comment.  A
							 | 
						|
								return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindString">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=21649:21694#L693">FindString</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindString(s <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindString returns a string holding the text of the leftmost match in s of the regular
							 | 
						|
								expression.  If there is no match, the return value is an empty string,
							 | 
						|
								but it will also be empty if the regular expression successfully matches
							 | 
						|
								an empty string.  Use FindStringIndex or FindStringSubmatch if it is
							 | 
						|
								necessary to distinguish these cases.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_FindString" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("fo.?")
							 | 
						|
								fmt.Printf("%q\n", re.FindString("seafood"))
							 | 
						|
								fmt.Printf("%q\n", re.FindString("meat"))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">"foo"
							 | 
						|
								""
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindStringIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=22017:22072#L705">FindStringIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindStringIndex(s <a href="../builtin/index.html#string">string</a>) (loc []<a href="../builtin/index.html#int">int</a>)</pre>
							 | 
						|
												<p>
							 | 
						|
								FindStringIndex returns a two-element slice of integers defining the
							 | 
						|
								location of the leftmost match in s of the regular expression.  The match
							 | 
						|
								itself is at s[loc[0]:loc[1]].
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_FindStringIndex" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("ab?")
							 | 
						|
								fmt.Println(re.FindStringIndex("tablett"))
							 | 
						|
								fmt.Println(re.FindStringIndex("foo") == nil)
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">[1 3]
							 | 
						|
								true
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindStringSubmatch">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=27458:27513#L887">FindStringSubmatch</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindStringSubmatch(s <a href="../builtin/index.html#string">string</a>) []<a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindStringSubmatch returns a slice of strings holding the text of the
							 | 
						|
								leftmost match of the regular expression in s and the matches, if any, of
							 | 
						|
								its subexpressions, as defined by the 'Submatch' description in the
							 | 
						|
								package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_FindStringSubmatch" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("a(x*)b(y|z)c")
							 | 
						|
								fmt.Printf("%q\n", re.FindStringSubmatch("-axxxbyc-"))
							 | 
						|
								fmt.Printf("%q\n", re.FindStringSubmatch("-abzc-"))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">["axxxbyc" "xxx" "y"]
							 | 
						|
								["abzc" "" "z"]
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindStringSubmatchIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=28056:28113#L906">FindStringSubmatchIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindStringSubmatchIndex(s <a href="../builtin/index.html#string">string</a>) []<a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindStringSubmatchIndex returns a slice holding the index pairs
							 | 
						|
								identifying the leftmost match of the regular expression in s and the
							 | 
						|
								matches, if any, of its subexpressions, as defined by the 'Submatch' and
							 | 
						|
								'Index' descriptions in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindSubmatch">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=22896:22945#L731">FindSubmatch</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindSubmatch(b []<a href="../builtin/index.html#byte">byte</a>) [][]<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindSubmatch returns a slice of slices holding the text of the leftmost
							 | 
						|
								match of the regular expression in b and the matches, if any, of its
							 | 
						|
								subexpressions, as defined by the 'Submatch' descriptions in the package
							 | 
						|
								comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.FindSubmatchIndex">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=27055:27106#L878">FindSubmatchIndex</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) FindSubmatchIndex(b []<a href="../builtin/index.html#byte">byte</a>) []<a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								FindSubmatchIndex returns a slice holding the index pairs identifying the
							 | 
						|
								leftmost match of the regular expression in b and the matches, if any, of
							 | 
						|
								its subexpressions, as defined by the 'Submatch' and 'Index' descriptions
							 | 
						|
								in the package comment.
							 | 
						|
								A return value of nil indicates no match.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.LiteralPrefix">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=12468:12532#L389">LiteralPrefix</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) LiteralPrefix() (prefix <a href="../builtin/index.html#string">string</a>, complete <a href="../builtin/index.html#bool">bool</a>)</pre>
							 | 
						|
												<p>
							 | 
						|
								LiteralPrefix returns a literal string that must begin any match
							 | 
						|
								of the regular expression re.  It returns the boolean true if the
							 | 
						|
								literal string comprises the entire regular expression.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.Longest">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=6535:6562#L149">Longest</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) Longest()</pre>
							 | 
						|
												<p>
							 | 
						|
								Longest makes future searches prefer the leftmost-longest match.
							 | 
						|
								That is, when matching against text, the regexp returns a match that
							 | 
						|
								begins as early as possible in the input (leftmost), and among those
							 | 
						|
								it chooses a match that is as long as possible.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.Match">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=12987:13025#L405">Match</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) Match(b []<a href="../builtin/index.html#byte">byte</a>) <a href="../builtin/index.html#bool">bool</a></pre>
							 | 
						|
												<p>
							 | 
						|
								Match reports whether the Regexp matches the byte slice b.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.MatchReader">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=12661:12712#L395">MatchReader</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) MatchReader(r <a href="../io/index.html">io</a>.<a href="../io/index.html#RuneReader">RuneReader</a>) <a href="../builtin/index.html#bool">bool</a></pre>
							 | 
						|
												<p>
							 | 
						|
								MatchReader reports whether the Regexp matches the text read by the
							 | 
						|
								RuneReader.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.MatchString">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=12828:12872#L400">MatchString</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) MatchString(s <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#bool">bool</a></pre>
							 | 
						|
												<p>
							 | 
						|
								MatchString reports whether the Regexp matches the string s.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.NumSubexp">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=9164:9197#L246">NumSubexp</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) NumSubexp() <a href="../builtin/index.html#int">int</a></pre>
							 | 
						|
												<p>
							 | 
						|
								NumSubexp returns the number of parenthesized subexpressions in this Regexp.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.ReplaceAll">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=17420:17473#L543">ReplaceAll</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) ReplaceAll(src, repl []<a href="../builtin/index.html#byte">byte</a>) []<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								ReplaceAll returns a copy of src, replacing matches of the Regexp
							 | 
						|
								with the replacement text repl.  Inside repl, $ signs are interpreted as
							 | 
						|
								in Expand, so for instance $1 represents the text of the first submatch.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.ReplaceAllFunc">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=18374:18451#L571">ReplaceAllFunc</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) ReplaceAllFunc(src []<a href="../builtin/index.html#byte">byte</a>, repl func([]<a href="../builtin/index.html#byte">byte</a>) []<a href="../builtin/index.html#byte">byte</a>) []<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								ReplaceAllFunc returns a copy of src in which all matches of the
							 | 
						|
								Regexp have been replaced by the return value of function repl applied
							 | 
						|
								to the matched byte slice.  The replacement returned by repl is substituted
							 | 
						|
								directly, without using Expand.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.ReplaceAllLiteral">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=17945:18005#L561">ReplaceAllLiteral</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) ReplaceAllLiteral(src, repl []<a href="../builtin/index.html#byte">byte</a>) []<a href="../builtin/index.html#byte">byte</a></pre>
							 | 
						|
												<p>
							 | 
						|
								ReplaceAllLiteral returns a copy of src, replacing matches of the Regexp
							 | 
						|
								with the replacement bytes repl.  The replacement repl is substituted directly,
							 | 
						|
								without using Expand.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.ReplaceAllLiteralString">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=14797:14863#L459">ReplaceAllLiteralString</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) ReplaceAllLiteralString(src, repl <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								ReplaceAllLiteralString returns a copy of src, replacing matches of the Regexp
							 | 
						|
								with the replacement string repl.  The replacement repl is substituted directly,
							 | 
						|
								without using Expand.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_ReplaceAllLiteralString" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("a(x*)b")
							 | 
						|
								fmt.Println(re.ReplaceAllLiteralString("-ab-axxb-", "T"))
							 | 
						|
								fmt.Println(re.ReplaceAllLiteralString("-ab-axxb-", "$1"))
							 | 
						|
								fmt.Println(re.ReplaceAllLiteralString("-ab-axxb-", "${1}"))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">-T-T-
							 | 
						|
								-$1-$1-
							 | 
						|
								-${1}-${1}-
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.ReplaceAllString">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=14324:14383#L445">ReplaceAllString</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) ReplaceAllString(src, repl <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								ReplaceAllString returns a copy of src, replacing matches of the Regexp
							 | 
						|
								with the replacement string repl.  Inside repl, $ signs are interpreted as
							 | 
						|
								in Expand, so for instance $1 represents the text of the first submatch.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_ReplaceAllString" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("a(x*)b")
							 | 
						|
								fmt.Println(re.ReplaceAllString("-ab-axxb-", "T"))
							 | 
						|
								fmt.Println(re.ReplaceAllString("-ab-axxb-", "$1"))
							 | 
						|
								fmt.Println(re.ReplaceAllString("-ab-axxb-", "$1W"))
							 | 
						|
								fmt.Println(re.ReplaceAllString("-ab-axxb-", "${1}W"))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">-T-T-
							 | 
						|
								--xx-
							 | 
						|
								---
							 | 
						|
								-W-xxW-
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.ReplaceAllStringFunc">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=15246:15329#L469">ReplaceAllStringFunc</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) ReplaceAllStringFunc(src <a href="../builtin/index.html#string">string</a>, repl func(<a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#string">string</a>) <a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								ReplaceAllStringFunc returns a copy of src in which all matches of the
							 | 
						|
								Regexp have been replaced by the return value of function repl applied
							 | 
						|
								to the matched substring.  The replacement returned by repl is substituted
							 | 
						|
								directly, without using Expand.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.Split">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=33846:33895#L1093">Split</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) Split(s <a href="../builtin/index.html#string">string</a>, n <a href="../builtin/index.html#int">int</a>) []<a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								Split slices s into substrings separated by the expression and returns a slice of
							 | 
						|
								the substrings between those expression matches.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								The slice returned by this method consists of all the substrings of s
							 | 
						|
								not contained in the slice returned by FindAllString. When called on an expression
							 | 
						|
								that contains no metacharacters, it is equivalent to strings.SplitN.
							 | 
						|
								</p>
							 | 
						|
								<p>
							 | 
						|
								Example:
							 | 
						|
								</p>
							 | 
						|
								<pre>s := regexp.MustCompile("a*").Split("abaabaccadaaae", 5)
							 | 
						|
								// s: ["", "b", "b", "c", "cadaaae"]
							 | 
						|
								</pre>
							 | 
						|
								<p>
							 | 
						|
								The count determines the number of substrings to return:
							 | 
						|
								</p>
							 | 
						|
								<pre>n > 0: at most n substrings; the last substring will be the unsplit remainder.
							 | 
						|
								n == 0: the result is nil (zero substrings)
							 | 
						|
								n < 0: all substrings
							 | 
						|
								</pre>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_Split" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">a := regexp.MustCompile("a")
							 | 
						|
								fmt.Println(a.Split("banana", -1))
							 | 
						|
								fmt.Println(a.Split("banana", 0))
							 | 
						|
								fmt.Println(a.Split("banana", 1))
							 | 
						|
								fmt.Println(a.Split("banana", 2))
							 | 
						|
								zp := regexp.MustCompile("z+")
							 | 
						|
								fmt.Println(zp.Split("pizza", -1))
							 | 
						|
								fmt.Println(zp.Split("pizza", 0))
							 | 
						|
								fmt.Println(zp.Split("pizza", 1))
							 | 
						|
								fmt.Println(zp.Split("pizza", 2))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">[b n n ]
							 | 
						|
								[]
							 | 
						|
								[banana]
							 | 
						|
								[b nana]
							 | 
						|
								[pi a]
							 | 
						|
								[]
							 | 
						|
								[pizza]
							 | 
						|
								[pi a]
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.String">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=4104:4137#L93">String</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) String() <a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								String returns the source text used to compile the regular expression.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												
							 | 
						|
												
							 | 
						|
											
							 | 
						|
												
							 | 
						|
												<h3 id="Regexp.SubexpNames">func (*Regexp) <a href="http://localhost:6060/src/regexp/regexp.go?s=9560:9600#L255">SubexpNames</a></h3>
							 | 
						|
												<pre>func (re *<a href="index.html#Regexp">Regexp</a>) SubexpNames() []<a href="../builtin/index.html#string">string</a></pre>
							 | 
						|
												<p>
							 | 
						|
								SubexpNames returns the names of the parenthesized subexpressions
							 | 
						|
								in this Regexp.  The name for the first sub-expression is names[1],
							 | 
						|
								so that if m is a match slice, the name for m[i] is SubexpNames()[i].
							 | 
						|
								Since the Regexp as a whole cannot be named, names[0] is always
							 | 
						|
								the empty string.  The slice should not be modified.
							 | 
						|
								</p>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
												<div id="example_Regexp_SubexpNames" class="toggle">
							 | 
						|
									<div class="collapsed">
							 | 
						|
										<p class="exampleHeading toggleButton">▹ <span class="text">Example</span></p>
							 | 
						|
									</div>
							 | 
						|
									<div class="expanded">
							 | 
						|
										<p class="exampleHeading toggleButton">▾ <span class="text">Example</span></p>
							 | 
						|
										
							 | 
						|
										
							 | 
						|
										
							 | 
						|
											<p>Code:</p>
							 | 
						|
											<pre class="code">re := regexp.MustCompile("(?P<first>[a-zA-Z]+) (?P<last>[a-zA-Z]+)")
							 | 
						|
								fmt.Println(re.MatchString("Alan Turing"))
							 | 
						|
								fmt.Printf("%q\n", re.SubexpNames())
							 | 
						|
								reversed := fmt.Sprintf("${%s} ${%s}", re.SubexpNames()[2], re.SubexpNames()[1])
							 | 
						|
								fmt.Println(reversed)
							 | 
						|
								fmt.Println(re.ReplaceAllString("Alan Turing", reversed))
							 | 
						|
								<span class="comment"></pre>
							 | 
						|
											
							 | 
						|
											<p>Output:</p>
							 | 
						|
											<pre class="output">true
							 | 
						|
								["" "first" "last"]
							 | 
						|
								${last} ${first}
							 | 
						|
								Turing Alan
							 | 
						|
								</pre>
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									</div>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
												
							 | 
						|
											
							 | 
						|
										
							 | 
						|
									
							 | 
						|
								
							 | 
						|
									
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
									
							 | 
						|
									
							 | 
						|
										<h2 id="pkg-subdirectories">Subdirectories</h2>
							 | 
						|
									
							 | 
						|
									
							 | 
						|
								
							 | 
						|
								
							 | 
						|
									<div class="pkg-dir">
							 | 
						|
										<table>
							 | 
						|
											<tr>
							 | 
						|
												<th class="pkg-name">Name</th>
							 | 
						|
												<th class="pkg-synopsis">Synopsis</th>
							 | 
						|
											</tr>
							 | 
						|
								
							 | 
						|
											
							 | 
						|
											<tr>
							 | 
						|
												<td colspan="2"><a href="http://localhost:6060/pkg/">..</a></td>
							 | 
						|
											</tr>
							 | 
						|
											
							 | 
						|
								
							 | 
						|
											
							 | 
						|
												
							 | 
						|
													<tr>
							 | 
						|
														<td class="pkg-name" style="padding-left: 0px;">
							 | 
						|
															<a href="syntax/index.html">syntax</a>
							 | 
						|
														</td>
							 | 
						|
														<td class="pkg-synopsis">
							 | 
						|
															Package syntax parses regular expressions into parse trees and compiles parse trees into programs.
							 | 
						|
														</td>
							 | 
						|
													</tr>
							 | 
						|
												
							 | 
						|
											
							 | 
						|
										</table>
							 | 
						|
									</div>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
									
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								<div id="footer">
							 | 
						|
								Build version go1.6.<br>
							 | 
						|
								Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
							 | 
						|
								the content of this page is licensed under the
							 | 
						|
								Creative Commons Attribution 3.0 License,
							 | 
						|
								and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
							 | 
						|
								<a href="http://localhost:6060/doc/tos.html">Terms of Service</a> | 
							 | 
						|
								<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
								</div><!-- .container -->
							 | 
						|
								</div><!-- #page -->
							 | 
						|
								
							 | 
						|
								<!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
							 | 
						|
								<script type="text/javascript" src="../../lib/godoc/jquery.js"></script>
							 | 
						|
								<script type="text/javascript" src="../../lib/godoc/jquery.treeview.js"></script>
							 | 
						|
								<script type="text/javascript" src="../../lib/godoc/jquery.treeview.edit.js"></script>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								<script type="text/javascript" src="../../lib/godoc/godocs.js"></script>
							 | 
						|
								
							 | 
						|
								</body>
							 | 
						|
								</html>
							 | 
						|
								
							 |