<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://hmoegirl.com/index.php?action=history&amp;feed=atom&amp;title=Template%3AStr_match</id>
	<title>Template:Str match - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://hmoegirl.com/index.php?action=history&amp;feed=atom&amp;title=Template%3AStr_match"/>
	<link rel="alternate" type="text/html" href="https://hmoegirl.com/index.php?title=Template:Str_match&amp;action=history"/>
	<updated>2026-04-26T13:33:17Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>https://hmoegirl.com/index.php?title=Template:Str_match&amp;diff=50330&amp;oldid=prev</id>
		<title>imported&gt;MJH：​创建页面，内容为“&lt;includeonly&gt;{{{{{|safesubst:}}}#invoke:String|match|s={{{str|}}}|pattern={{{{{|safesubst:}}}unwiki|{{{ptn|}}}}}|match={{{match|}}}|plain=false|nomatch={{{nomatch|}}…”</title>
		<link rel="alternate" type="text/html" href="https://hmoegirl.com/index.php?title=Template:Str_match&amp;diff=50330&amp;oldid=prev"/>
		<updated>2021-06-24T02:21:58Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“&amp;lt;includeonly&amp;gt;{{{{{|safesubst:}}}#invoke:String|match|s={{{str|}}}|pattern={{{{{|safesubst:}}}unwiki|{{{ptn|}}}}}|match={{{match|}}}|plain=false|nomatch={{{nomatch|}}…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;includeonly&amp;gt;{{{{{|safesubst:}}}#invoke:String|match|s={{{str|}}}|pattern={{{{{|safesubst:}}}unwiki|{{{ptn|}}}}}|match={{{match|}}}|plain=false|nomatch={{{nomatch|}}}}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;{{doc|content=&lt;br /&gt;
== 简介 ==&lt;br /&gt;
&lt;br /&gt;
这个模板将对正则表达式的查询结果进行分捕获组的输出，若未定义捕获组，则输出整个匹配的字符串。&lt;br /&gt;
&lt;br /&gt;
若正则未匹配到结果，则输出空。&lt;br /&gt;
&lt;br /&gt;
;这个模板使用的是Lua的正则表达式。若遇到Lua正则无法实现的问题，可以考虑使用{{tl|regex}}模板（PHP的正则表达式）。&lt;br /&gt;
&lt;br /&gt;
== 用法 ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{{str match|str= &amp;lt;!-- 要查询的字符串 --&amp;gt;|ptn= &amp;lt;!-- 正则表达式，支持以&amp;lt;nowiki&amp;gt;标签包裹的格式传入 --&amp;gt;&lt;br /&gt;
|match= 捕获组编号，默认为1|nomatch=未匹配到时输出的内容，默认为空}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 示例 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;{{str match|str=123|ptn=%d(%d)%d}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;输出：&amp;#039;&amp;#039;&amp;#039;{{str match|str=123|ptn=%d(%d)%d}}&lt;br /&gt;
&lt;br /&gt;
[[分类:辅助模板]]}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;MJH</name></author>
	</entry>
</feed>