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

📄 regexp.html

📁 javascript 1.5规范
💻 HTML
📖 第 1 页 / 共 5 页
字号:
</FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193306"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\r</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193308"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches a carriage return.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193310"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\s</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193312"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches a single white space character, including space, tab, form feed, line feed. Equivalent to <FONT FACE="courier, couriernew, monospaced size">[ \f\n\r\t\u00A0\u2028\u2029]</FONT>.</ztabletext></FONT><P><A NAME="1193313"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>For example, <FONT FACE="courier, couriernew, monospaced size">/\s\w*/</FONT> matches ' bar' in "foo bar."</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193315"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\S</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193317"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches a single character other than white space. Equivalent to <br><FONT FACE="courier, couriernew, monospaced size">[^ \f\n\r\t\u00A0\u2028\u2029]</FONT>.</ztabletext></FONT><P><A NAME="1193318"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>For example, <FONT FACE="courier, couriernew, monospaced size">/\S/\w*</FONT> matches 'foo' in "foo bar."</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193320"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\t</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193322"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches a tab.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193324"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\v</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193326"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches a vertical tab.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193328"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\w</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193330"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches any alphanumeric character including the underscore. Equivalent to <FONT FACE="courier, couriernew, monospaced size">[A-Za-z0-9_]</FONT>.</ztabletext></FONT><P><A NAME="1193331"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>For example, <FONT FACE="courier, couriernew, monospaced size">/\w/</FONT> matches 'a' in "apple," '5' in "$5.28," and '3' in "3D."</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193333"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\W </zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193335"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches any non-word character. Equivalent to <FONT FACE="courier, couriernew, monospaced size">[^A-Za-z0-9_]</FONT>.</ztabletext></FONT><P><A NAME="1193336"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>For example, <FONT FACE="courier, couriernew, monospaced size">/\W/</FONT> or <FONT FACE="courier, couriernew, monospaced size">/[^$A-Za-z0-9_]/</FONT> matches '%' in "50%."</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193338"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\<I>n</I></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193340"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Where <I>n</I> is a positive integer. A back reference to the last substring matching the <I>n</I> parenthetical in the regular expression (counting left parentheses).</ztabletext></FONT><P><A NAME="1193341"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>For example, <FONT FACE="courier, couriernew, monospaced size">/apple(,)\sorange\1/</FONT> matches 'apple, orange', in "apple, orange, cherry, peach." A more complete example follows this table.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1193344"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\0</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1193346"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches a NUL character. Do not follow this with another digit.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1208393"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\xhh</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1208395"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches the character with the code hh (two hexadecimal digits)</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1208389"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline>\uhhhh</zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1208391"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Matches the character with code hhhh (four hexadecimal digits).</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></FONT><P><A NAME="1193347"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The literal notation provides compilation of the regular expression when the expression is evaluated. Use literal notation when the regular expression will remain constant. For example, if you use literal notation to construct a regular expression used in a loop, the regular expression won't be recompiled on each iteration. </zparagraph></FONT><P><A NAME="1193348"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>The constructor of the regular expression<B> </B>object, for example, <FONT FACE="courier, couriernew, monospaced size">new&nbsp;RegExp("ab+c")</FONT>, provides runtime compilation of the regular expression. Use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input. </zparagraph></FONT><P><A NAME="1211678"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>A separate predefined <FONT FACE="courier, couriernew, monospaced size">RegExp</FONT> object is available in each window; that is, each separate thread of JavaScript execution gets its own <FONT FACE="courier, couriernew, monospaced size">RegExp</FONT> object. Because each script runs to completion without interruption in a thread, this assures that different scripts do not overwrite values of the <FONT FACE="courier, couriernew, monospaced size">RegExp</FONT> object.</zparagraph></FONT><P><BR><A NAME="1211719"> </A><A NAME="Property Summary"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Property Summary</zrefheader></B></FONT><BR><A NAME="1193394"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph>Note that several of the <FONT FACE="courier, couriernew, monospaced size">RegExp</FONT> properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions.</zparagraph></FONT><P><P><A NAME="1203846"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR BGCOLOR="#CCCCCC" ALIGN=LEFT VALIGN=TOP>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1209503"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Property</ztablehead></B></FONT></TH>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1209505"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Description</ztablehead></B></FONT></TH>  </DIV></TR>  <TR>    <TD VALIGN=TOP><A NAME="1209577"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="regexp.html#1213253"  >constructor</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1209579"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Specifies the function that creates an object's prototype.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1209584"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="regexp.html#1194562"  >global</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1209586"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Whether to test the regular expression against all possible matches in a string, or only against the first. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1209591"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="regexp.html#1193678"  >ignoreCase</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1209593"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Whether to ignore case while attempting a match in a string. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1209605"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="regexp.html#1193732"  >lastIndex</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1209607"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>The index at which to start the next match. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1209633"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="regexp.html#1193831"  >multiline</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1209635"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Whether or not to search in strings across multiple lines. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><A NAME="1209640"></A><FONT FACE="courier, couriernew, monospaced size" SIZE="2"><zcodeline><A HREF="regexp.html#1200174"  >prototype</A></zcodeline></FONT><P>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1209642"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>Allows the addition of properties to all objects.</ztabletext></FONT>&nbsp;</TD>  </TR>  <TR>    <TD VALIGN=TOP><P><A NAME="1209654"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext><A HREF="regexp.html#1193875"  >source</A></ztabletext></FONT>&nbsp;</TD>    <TD VALIGN=TOP><P><A NAME="1209656"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><ztabletext>The text of the pattern. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</ztabletext></FONT>&nbsp;</TD>  </TR></TABLE><P></FONT><P><BR><A NAME="1193537"> </A><A NAME="Method Summary"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><zrefheader>Method Summary</zrefheader></B></FONT><BR><A NAME="1193571"> </A><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><zparagraph><BR><P><TABLE WIDTH="90%" BORDER="1" CELLPADDING="5" CELLSPACING="0">  <CAPTION></CAPTION><P><FONT FACE=""><B></B></FONT><BR><BR>  <TR BGCOLOR="#CCCCCC" ALIGN=LEFT VALIGN=TOP>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1193540"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Method</ztablehead></B></FONT></TH>    <TH VALIGN=TOP ALIGN=LEFT><A NAME="1193542"> </A><P ALIGN="LEFT"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2"><B><ztablehead>Description</ztablehead></B></FONT></TH>  </DIV></TR>

⌨️ 快捷键说明

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