aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/exslt/regexp/match/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/exslt/regexp/match/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/exslt/regexp/match/index.html')
-rw-r--r--files/zh-cn/web/exslt/regexp/match/index.html69
1 files changed, 69 insertions, 0 deletions
diff --git a/files/zh-cn/web/exslt/regexp/match/index.html b/files/zh-cn/web/exslt/regexp/match/index.html
new file mode 100644
index 0000000000..2aebf1da22
--- /dev/null
+++ b/files/zh-cn/web/exslt/regexp/match/index.html
@@ -0,0 +1,69 @@
+---
+title: match
+slug: Web/EXSLT/regexp/match
+translation_of: Web/EXSLT/regexp/match
+---
+<p>{{ XsltRef() }} {{ Fx_minversion_header(3) }}</p>
+
+<p><br>
+ <code>regexp:match()</code> performs regular expression matching on a string, returning the submatches found as a result.</p>
+
+<h3 id="Syntax" name="Syntax">语法</h3>
+
+<pre class="eval">regexp:match(<em>targetString</em>,<em>regExpString</em>[[,<em>flagsString</em>]])
+</pre>
+
+<h3 id="Arguments" name="Arguments">参数</h3>
+
+<dl>
+ <dt><code><em>targetString</em></code></dt>
+ <dd>The string to perform regular expression matching upon.</dd>
+ <dt><code><em>regExpString</em></code></dt>
+ <dd>The JavaScript style regular expression to evaluate.</dd>
+ <dt><code><em>flagsString</em></code></dt>
+ <dd>An optional string containing character flags.</dd>
+</dl>
+
+<p>The character flags are:</p>
+
+<dl>
+ <dt><code>g</code></dt>
+ <dd>全局匹配</dd>
+ <dd>The submatches from every match in the string are returned. If this flag isn't specified, only the submatches from the first match are returned.</dd>
+ <dt><code>i</code></dt>
+ <dd>Case insensitive match</dd>
+ <dd>If this flag is specified, the match is performed in a case insensitive fashion.</dd>
+</dl>
+
+<h3 id="Returns" name="Returns">Returns</h3>
+
+<p>A node set of <code>match</code> elements, each of which has the string value equal to a portion of the first parameter string as captured by the regular expression. If the match isn't a global one, the first match element has the value of the portion of the string matched by the entire regular expression.</p>
+
+<p>例如:</p>
+
+<pre class="eval">&lt;xsl:for-each select="regExp:match('<span class="nowiki">http://developer.mozilla.org/en/docs/Firefox_3_for_developers</span>',
+ '(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)')"&gt;
+ Part &lt;xsl:value-of select="position()" /&gt; = &lt;xsl:value-of select="." /&gt;
+&lt;/xsl:for-each&gt;
+</pre>
+
+<p>This code generates the following output:</p>
+
+<pre class="eval">Part 1 = <span class="nowiki">http://developer.mozilla.org/en/docs/Firefox_3_for_developers</span>
+Part 2 = http
+Part 3 = developer.mozilla.org
+Part 4 =
+Part 5 = /en/docs/Firefox_3_for_developers
+</pre>
+
+<h3 id="Defined" name="Defined">定义</h3>
+
+<p><a class="external" href="http://www.exslt.org/regexp/functions/match/index.html">EXSLT - REGEXP:MATCH</a></p>
+
+<h3 id="Gecko_support" name="Gecko_support">Gecko support</h3>
+
+<p>Supported in Gecko 1.9 and later.</p>
+
+<div class="noinclude"> </div>
+
+<p>{{ languages( { "es": "es/EXSLT/regexp/match", "fr": "fr/EXSLT/regexp/match" } ) }}</p>