Regular expression: Difference between revisions
Jump to navigation
Jump to search
→快速查表
No edit summary |
(→快速查表) |
||
| Line 91: | Line 91: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> 包含「狐狸」的行 <br /> {{kbd | key = <nowiki>^.*狐狸.*$</nowiki>}}</td> | <td> 包含「狐狸」的行 <br /> {{kbd | key = <nowiki>^.*狐狸.*$</nowiki>}} 或 {{kbd | key = <nowiki>(狐狸)</nowiki>}} ([https://regex101.com/r/UEtYst/1 demo])</td> | ||
<td> | <td> | ||
<span style="background:#C6E3FF">What Does the Fox Say? 12 狐狸怎叫 34</span><br /> | <span style="background:#C6E3FF">What Does the Fox Say? 12 狐狸怎叫 34</span><br /> | ||
What Does the shiba inu say? 柴犬怎叫 | What Does the shiba inu say? 柴犬怎叫 | ||
</td> | </td> | ||
<td>不包含「狐狸」的行 | <td>不包含「狐狸」的行 ([https://regex101.com/r/rvncjU/1 demo]) <br /> {{kbd | key = <nowiki>^((?!狐狸).)*$</nowiki>}} </td> | ||
<td> | <td> | ||
What Does the Fox Say? 12 狐狸怎叫 34<br /> | What Does the Fox Say? 12 狐狸怎叫 34<br /> | ||
| Line 113: | Line 113: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> 布林邏輯 OR: 包含「狐狸」或「叫」的行 ([ | <td> 布林邏輯 OR: 包含「狐狸」或「叫」的行 ([https://regexr.com/6cu06 demo])<br /> {{kbd | key = <nowiki>.*(狐狸|叫).*</nowiki>}}</td> | ||
<td> | <td> | ||
<span style="background:#C6E3FF">What Does the Fox Say? 12 狐狸怎叫 34<br /> | <span style="background:#C6E3FF">What Does the Fox Say? 12 狐狸怎叫 34<br /> | ||
| Line 125: | Line 125: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td> 布林邏輯 NOT: 不包含「狐狸」,但包含「柴犬」的行 ([http://regexr.com/3aokr demo])<ref>[http://stackoverflow.com/questions/2953039/regular-expression-for-a-string-containing-one-word-but-not-another regex - Regular expression for a string containing one word but not another - Stack Overflow]</ref><br /> {{kbd | key = <nowiki>^((?!狐狸).)*(柴犬).*$</nowiki>}} = {{kbd | key = <nowiki>^(柴犬).*((?!狐狸).)*$</nowiki>}} = {{kbd | key = <nowiki>(柴犬).*((?!狐狸).)*</nowiki>}}</td> | <td> 布林邏輯 NOT: 不包含「狐狸」,但包含「柴犬」的行 ([http://regexr.com/3aokr demo])<ref>[http://stackoverflow.com/questions/2953039/regular-expression-for-a-string-containing-one-word-but-not-another regex - Regular expression for a string containing one word but not another - Stack Overflow]</ref><br /> {{kbd | key = <nowiki>^((?!狐狸).)*(柴犬).*$</nowiki>}} = {{kbd | key = <nowiki>^(柴犬).*((?!狐狸).)*$</nowiki>}} = {{kbd | key = <nowiki>(柴犬).*((?!狐狸).)*</nowiki>}} (如果句子同時存在狐狸和柴犬會出錯) </td> | ||
<td> | <td> | ||
What Does the Fox Say? 12 狐狸怎叫 34<br /> | What Does the Fox Say? 12 狐狸怎叫 34<br /> | ||