Regular expression: Difference between revisions

Jump to navigation Jump to search
Line 13: Line 13:
[https://regex101.com/r/zH7wV3/1 online demo]
[https://regex101.com/r/zH7wV3/1 online demo]


<table style="border: 1px #000 solid">
<table border="1">
<tr>
<tr>
<th> 文字類型 </th>
<th style="width:150px;"> 文字類型 </th>
<th> 包含 </th>
<th> 包含 </th>
<th> 不包含 </th>
<th> 包含 sample </th>
<th style="width:150px;"> 不包含 </th>
<th> 不包含 sample</th>
</tr>
</tr>
<tr>
<tr>
<th> 任意一個文字(包含空白) </th>
<th> 任意一個文字(包含空白) </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>.</nowiki>}} </td>
<td> {{kbd | key = <nowiki>.</nowiki>}} </td>
<td style="border: 1px #000 solid"></td>
<td><span style="background:#C6E3FF">W</span>hat Does the Fox Say? 12 狐狸怎叫 34</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<th> 任意文字(包含空白),出現1次或0次 </th>
<th> 任意文字(包含空白),出現1次或0次 </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>.?</nowiki>}} = {{kbd | key = <nowiki>.{0,1}</nowiki>}}</td>
<td> {{kbd | key = <nowiki>.?</nowiki>}} = {{kbd | key = <nowiki>.{0,1}</nowiki>}}</td>
<td style="border: 1px #000 solid"></td>
<td><span style="background:#C6E3FF">W</span>hat Does the Fox Say? 12 狐狸怎叫 34</td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<th> 任意次的多個文字(包含空白) </th>
<th> 任意次的多個文字(包含空白) </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>.*</nowiki>}} ={{kbd | key = <nowiki> .{0,}</nowiki>}}</td>
<td> {{kbd | key = <nowiki>.*</nowiki>}} ={{kbd | key = <nowiki> .{0,}</nowiki>}}</td>
<td style="border: 1px #000 solid"></td>
<td><span style="background:#C6E3FF">What Does the Fox Say? 12 狐狸怎叫 34</span></td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<th> 任意次的文字(包含空白),至少出現1次 </th>
<th> 任意次的文字(包含空白),至少出現1次 </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>.+</nowiki>}} = {{kbd | key = <nowiki>.{1,}</nowiki>}}</td>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>.+</nowiki>}} = {{kbd | key = <nowiki>.{1,}</nowiki>}}</td>
<td style="border: 1px #000 solid"></td>
<td><span style="background:#C6E3FF">What Does the Fox Say? 12 狐狸怎叫 34</span></td>
<td></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<th> 任意次的空白 </th>
<th> 任意次的空白 </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>\s+</nowiki>}} </td>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>\s+</nowiki>}} </td>
<td>What<span style="background:#C6E3FF"> </span>Does the Fox Say? 12 狐狸怎叫 34</td>
<td style="border: 1px #000 solid">任意多個文字(不包含空白) {{kbd | key = <nowiki>[^\s]+</nowiki>}} ={{kbd | key = <nowiki> [^\s]{1,}</nowiki>}}</td>
<td style="border: 1px #000 solid">任意多個文字(不包含空白) {{kbd | key = <nowiki>[^\s]+</nowiki>}} ={{kbd | key = <nowiki> [^\s]{1,}</nowiki>}}</td>
<td><span style="background:#C6E3FF">What</span> Does the Fox Say? 12 狐狸怎叫 34</td>
</tr>
</tr>
<tr>
<tr>
<th> 任意次的英文和數字文字(包含空白) </th>
<th> 任意次的英文和數字文字(包含空白) </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>[\x00-\x80]+</nowiki>}}</td>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>[\x00-\x80]+</nowiki>}}</td>
<td style="border: 1px #000 solid">非英文或數字的文字,出現任意次 {{kbd | key = <nowiki>[^\x00-\x80]+</nowiki>}}</td>
<td><span style="background:#C6E3FF">What Does the Fox Say? 12</span> 狐狸怎叫 34</td>
<td style="border: 1px #000 solid">非英文或數字的文字,出現任意次<br /> {{kbd | key = <nowiki>[^\x00-\x80]+</nowiki>}}</td>
<td>What Does the Fox Say? 12 <span style="background:#C6E3FF">狐狸怎叫</span> 34</td>
</tr>
</tr>
<tr>
<tr>
<th> 任意次的英文和數字文字(不包含空白) </th>
<th> 任意次的英文和數字文字(不包含空白) </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>[\w]+</nowiki>}}</td>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>[\w]+</nowiki>}}</td>
<td><span style="background:#C6E3FF">What</span> Does the Fox Say? 12 狐狸怎叫 34</td>
<td style="border: 1px #000 solid"></td>
<td style="border: 1px #000 solid"></td>
<td></td>
</tr>
</tr>
<tr>
<tr>
<th> 任意次的數字(不包含空白) </th>
<th> 任意次的數字(不包含空白) </th>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>[\d]+</nowiki>}} = {{kbd | key = <nowiki>[0-9]+</nowiki>}}</td>
<td style="border: 1px #000 solid"> {{kbd | key = <nowiki>[\d]+</nowiki>}} = {{kbd | key = <nowiki>[0-9]+</nowiki>}}</td>
<td>What Does the Fox Say? <span style="background:#C6E3FF">12</span> 狐狸怎叫 34</td>
<td style="border: 1px #000 solid">不包含數字的任意次文字  {{kbd | key = <nowiki>[^\d]+</nowiki>}} </td>
<td style="border: 1px #000 solid">不包含數字的任意次文字  {{kbd | key = <nowiki>[^\d]+</nowiki>}} </td>
<td><span style="background:#C6E3FF">What Does the Fox Say? </span>12 狐狸怎叫 34</td>
</tr>
</tr>
</table>
</table>

Navigation menu