⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 13-grep.mht

📁 这是著名的源码浏览工具(不仅仅浏览
💻 MHT
📖 第 1 页 / 共 5 页
字号:
      just <SPAN class=3DBold>a</SPAN>'s or <SPAN =
class=3DBold>f</SPAN>'s or the=20
      empty string</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998307></A><SPAN =
class=3DBold>[^...]</SPAN>=20
      </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998309></A>matches any =
character except=20
      the ones specified</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998311></A><SPAN=20
      class=3DBold>[^a-z]<BR></SPAN>matches any characters except =
lower-case=20
      letters</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998313></A><SPAN =
class=3DBold>^</SPAN>=20
      (caret)</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998315></A>matches the empty =
string, but=20
      only at the beginning of the line</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998317></A><SPAN=20
      class=3DBold>^foo<BR></SPAN>matches <SPAN class=3DBold>foo</SPAN> =
and <SPAN=20
      class=3DBold>food</SPAN>, but not <SPAN class=3DBold>ofoo</SPAN> =
</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998319></A><SPAN =
class=3DBold>$</SPAN>=20
      (dollar sign)</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998321></A>matches the empty =
string, but=20
      only at the end of the line</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998323></A><SPAN=20
      class=3DBold>fo$<BR></SPAN>matches a string ending in <SPAN=20
      class=3DBold>fo</SPAN>, but not <SPAN class=3DBold>foop</SPAN> =
</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998325></A><SPAN =
class=3DBold>\</SPAN>=20
      (backslash)</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998327></A>escapes special =
characters=20
      (including \)</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998329></A><SPAN=20
      class=3DBold>fo\?<BR></SPAN>matches <SPAN class=3DBold>fo?</SPAN> =
</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998331></A><SPAN =
class=3DBold>|</SPAN>=20
      (pipe)</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998333></A>is used to =
designate OR</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998335></A><SPAN=20
      class=3DBold>foo|bar<BR></SPAN>matches either <SPAN =
class=3DBold>foo</SPAN> or=20
      <SPAN class=3DBold>bar</SPAN> </P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998337></A><SPAN =
class=3DBold>( ... )</SPAN>=20
      </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998339></A>is a grouping =
construct</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998341></A><SPAN=20
      class=3DBold>foo(bar)*<BR></SPAN>matches zero or more instances of =
bar with=20
      foo (such as <SPAN class=3DBold>foo</SPAN>, <SPAN =
class=3DBold>foobar</SPAN>,=20
      and <SPAN =
class=3DBold>foobarbar</SPAN>)</P></TD></TR></TBODY></TABLE>
<H3 class=3DLabel><A name=3DpgfId-998343></A>Note</H3>
<P class=3DNote><A name=3DpgfId-998344></A>In the <SPAN =
class=3DBold>|</SPAN> (pipe)=20
example above, notice that <SPAN class=3DBold>foo|bar</SPAN> is matching =
either=20
<SPAN class=3DBold>foo</SPAN> or <SPAN class=3DBold>bar</SPAN>. It's not =
matching=20
<SPAN class=3DBold>o</SPAN> or <SPAN class=3DBold>b</SPAN>, resulting =
with either=20
<SPAN class=3DBold>fooar</SPAN> or <SPAN class=3DBold>fobar</SPAN>.</P>
<H3 class=3DHeading2><A name=3DpgfId-998345></A>Predefined Sets of =
Characters</H3>
<P class=3DBody><A name=3DpgfId-998346></A>Certain named classes of =
characters are=20
predefined, but can only be used within bracket expressions. </P>
<TABLE border=3D1>
  <CAPTION>
  <P class=3DTableTitle><A name=3DpgfId-998352></A>Character Classes =
</P></CAPTION>
  <TBODY>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellHeading><A name=3DpgfId-998358></A>Symbol</P></TD>
    <TD>
      <P class=3DCellHeading><A =
name=3DpgfId-998360></A>Definition</P></TD>
    <TD>
      <P class=3DCellHeading><A name=3DpgfId-998362></A>C-locale=20
Equivalent</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998364></A><SPAN=20
      class=3DBold>[:alnum:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998366></A>alphanumeric =
characters</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998368></A><SPAN=20
      class=3DBold>[a-zA-Z0-9]</SPAN> </P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998370></A><SPAN=20
      class=3DBold>[:alpha:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998372></A>alphabetic =
characters</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998374></A><SPAN=20
      class=3DBold>[a-zA-Z]</SPAN> </P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998376></A><SPAN=20
      class=3DBold>[:blank:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998378></A>space and tab =
characters</P></TD>
    <TD>
      <P class=3DCellBody><A =
name=3DpgfId-998380></A>&nbsp;</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998382></A><SPAN=20
      class=3DBold>[:cntrl:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998384></A>control =
characters</P></TD>
    <TD>
      <P class=3DCellBody><A =
name=3DpgfId-998386></A>&nbsp;</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998388></A><SPAN=20
      class=3DBold>[:digit:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998390></A>numeric =
characters</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998392></A><SPAN =
class=3DBold>[0-9]</SPAN>=20
      </P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998394></A><SPAN=20
      class=3DBold>[:graph:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998396></A>characters that are =
printable=20
      and are also visible (a tab is printable, but not visible, while =
an <SPAN=20
      class=3DBold>a</SPAN> is both)</P></TD>
    <TD>
      <P class=3DCellBody><A =
name=3DpgfId-998398></A>&nbsp;</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998400></A><SPAN=20
      class=3DBold>[:lower:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998402></A>lower-case =
alphabetic=20
      characters</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998404></A><SPAN =
class=3DBold>[a-z]</SPAN>=20
      </P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998406></A><SPAN=20
      class=3DBold>[:print:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998408></A>printable =
characters (ASCII 32=20
      and above), but not control characters</P></TD>
    <TD>
      <P class=3DCellBody><A =
name=3DpgfId-998410></A>&nbsp;</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998412></A><SPAN=20
      class=3DBold>[:punct:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998414></A>punctuation =
characters</P></TD>
    <TD>
      <P class=3DCellBody><A =
name=3DpgfId-998416></A>&nbsp;</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998418></A><SPAN=20
      class=3DBold>[:space:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998420></A>space characters =
(such as=20
      space, tab, newline, and page eject)</P></TD>
    <TD>
      <P class=3DCellBody><A =
name=3DpgfId-998422></A>&nbsp;</P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998424></A><SPAN=20
      class=3DBold>[:upper:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998426></A>upper-case =
alphabetic=20
      characters</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998428></A><SPAN =
class=3DBold>[A-Z]</SPAN>=20
      </P></TD></TR>
  <TR vAlign=3Dtop>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998430></A><SPAN=20
      class=3DBold>[:xdigit:]</SPAN> </P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998432></A>hexadecimal digit=20
    characters</P></TD>
    <TD>
      <P class=3DCellBody><A name=3DpgfId-998434></A><SPAN=20
      class=3DBold>[0-9a-fA-F]</SPAN> </P></TD></TR></TBODY></TABLE>
<P class=3DBody><A name=3DpgfId-998435></A>For example, <SPAN=20
class=3DBold>[[:alnum:]]</SPAN> means <SPAN class=3DBold>[0-9A-Za-z] =
</SPAN>in the=20
C-locale, except the latter form is dependent upon the ASCII character =
encoding,=20
whereas the former is portable.</P>
<H3 class=3DHeading2><A name=3DpgfId-998436></A>Repetition</H3>
<P class=3DBody><A name=3DpgfId-998437></A>A regular expression matching =
a single=20
character may be followed by one of several repetition operator:</P>
<TABLE border=3D1>
  <CAPTION>
  <P class=3DTableTitle><A name=3DpgfId-998443></A>Interval Expressions=20
  </P></CAPTION>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -