javascript: ÕýÔò±í´ïʽ
ÕýÔò±í´ïʽ
RegExp(regexp, option)ÀàʵÏÖ,¿ÉÒÔ¼òд³É/regexp/option
option:
g: global, i: ignore case
·½·¨:string.test(regexp),
string.exec(regexp)[·µ»ØËùÓÐÆ¥ÅäµÄµØ·½], string.serch(regexp)[ÕýÔò°æµÄindexOf()],
string.replace(regexp, str|funtion), string.split(regexp)
¼òµ¥Ä£Ê½
Ôª×Ö·û:( [ {
\ ^ $ | ) ? * + . ʹÓõÄʱºòÓÃ'\'תÒå
ÌØÊâ×Ö·û:\x62[16½øÖÆ],
\u0062[unicode], \t, \n, \r, \f[»»Ò³], \a[alert],\e[escape], \cX[¿ØÖÆ×Ö·û],
\b[»ØÍË×Ö·û], \v[´¹Ö±ÖƱí·û], \0[¿Õ×Ö·û]
Ô¤¶¨Òå×Ö·û£º¡¡.==[^\n\r], \d == [0-9], \D
== [^0-9], \s == [ \t\n\x0B\f\r], \S == [^ \t\n\x0B\f\r],
\w=[a-zA-Z_0-9], \W=[^a-zA-Z_0-9]
Á¿´Ê
¼òµ¥Á¿´Ê
?:
³öÏÖ0´Î»ò1´Î
*: ³öÏÖ0´Î»ò¶à´Î
+: ³öÏÖ1´Î»ò¶à´Î
{n}£º³öÏÖn´Î
{n,
m}: ÖÁÉÙ³öÏÖn´Î£¬µ«²»³¬¹ým´Î
{n,}:ÖÁÉÙ³öÏÖn´Î
Ì°
À·µÄ¡¢¶èÐԵĺÍÖ§ÅäÐÔµÄÁ¿´Ê
Ì°À·Á¿´Ê£º¾¡¿ÉÄܶàµØÆ¥Åä¸ü¶àµÄ×Ö·û£¨default£©
¶èÐÔÁ¿´Ê£º¾¡¿ÉÄÜÉÙµÄÆ¥
Åä¸üÉÙµÄ×Ö·û£¨¼òµ¥Á¿´Êºó¼Ó?)
Ö§ÅäÁ¿´Ê£ºÖ»³¢ÊÔÆ¥ÅäÕû¸ö×Ö·û´®£¨¼òµ¥Á¿´Êºó¼Ó+)
¸´ÔÓģʽ
·Ö
×飺
ÓÃ()·Ö×飬·Ö×é¿ÉǶÌ×
·´ÏòÒýÓãº
ÀûÓ÷Ö×飬$n
ºòÑ¡£º
ÀàËÆ»ò |
·Ç
²¶»ñÐÔ·Ö×飺
±ÜÃâ·´ÏòÒýÓõĿªÏú¡£(?:xxx)
Ç°Õ°£¨look ahead£©£º
(?=xxx)-->positive,
(?!xxx)-->negative
±ß½ç:
^:ÐпªÍ·
$:
Ðнáβ
\b: µ¥´Ê±ß½ç
\B: ·Çµ¥´Ê±ß½ç
¶àÐÐģʽ:
/mÑ¡Ïî
RegExp
¶ÔÏó
instanceÊôÐÔ
global: /g
ignoreCase: /i
lastIndex:
´ú±íÏ´ÎÆ¥Å佫»á´ÓÄĸö×Ö·û¿ªÊ¼£¬Ö»ÔÚexec()»òtest()ʱÉèÖá£
multiline£º/m
source:
ÕýÔò±í´ïʽµÄÔ´×Ö·ûÐÎʽ¡£
¾²Ì¬ÊôÐÔ
¾²Ì¬ÊôÐÔ¶ÔËùÓÐÕýÔò±í´ïʽ¶¼ÓÐЧ£¬ÓÐÁ½¸öÃû
×Ö£¬Ò»¸ö³¤Ãû£¬Ò»¸ö¶ÌÃû¡£Ã¿´ÎÖ´ÐÐexec()»òtest()ʱ£¬ËùÓеÄÊôÐÔ£¨³ýmultilineÍ⣩¶¼»á±»ÖØÐÂÉèÖÃ
input/$_:
×îºóÓÃÓÚÆ¥ÅäµÄ×Ö·û´®£¨´«µÝ¸øexec()»òtest()µÄ×Ö·û´®£©
lastMatch/$&: ×îºóÆ¥ÅäµÄ×Ö·û´®
lastParen/$+:
×îºóÆ¥ÅäµÄ·Ö×é
leftContext/$`:ÔÚÉÏ´ÎÆ¥ÅäµÄÇ°ÃæµÄ×Ö·û´®
multiline/$*:
ÓÃÓÚÖ¸¶¨ÊÇ·ñËùÓеıí´ïʽ¶¼Ê¹ÓöàÐÐģʽ¡£ieºÍoperaÔݲ»Ö§³Ö£¬ËùÒÔ×îºÃÓÃ/mÉèÖöàÐÐ
rightContext/$':ÔÚÉÏ´Î
Æ¥ÅäµÄºóÃæµÄ×Ö·û´®
³£ÓÃģʽ
ÈÕÆÚ£¬dd/mm/yyyy:
²ÉÓ÷Dz¶»ñÐÔ·Ö×飺date =
/(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/(?:19|20\d{2})/;
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
1. ÈÃÎÄ×Ö²»Í£µÄ¹ö¶¯¡£
<marouee>¹ö¶¯ÎÄ×Ö</marouee>
2.¼Ç¼²¢ÏÔʾÍøÒ³µÄ×îºóÐÞ¸Äʱ¼ä
<script language="javascript">
doucument.write("×îºó¸üÐÂʱ¼ä£º" + document.lastModified + " " ......
var vKeyCode= e.getKeyCode();
if (vKeyCode >= 65 && vKeyCode <= 90 ) // Caps Lock ´ò¿ª
{
......
function BOX_show(e,obj)//ÏÔʾ
{
if(obj<24)
document.cookie = "tdid="+obj;
if(document.getElementById(e)==null)
{
return ;
}
&n ......
ÔÚsilverlight¿ª·¢ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃjsÀ´µ÷ÓÃsilverlightÖеķ½·¨£¨µ±È»·½·¨ÉÏÒªÀ¦°óÏàÓ¦ÊôÐÔ£©£¬Ò²¿ÉÒÔ½«Ö¸¶¨
µÄjs·½·¨°ó¶¨µ½silverlightÓ¦ÓÃÖеÄʼþÉÏ£®±¾DEMOÑÝʾÁËͨ¹ýjsµ÷ÓÃÍê³ÉsilverlightÊý¾ÝÁбí¿Ø¼þ(DataGrid)µÄÊý
¾Ý°ó¶¨²Ù×÷£¬²¢Í¨¹ýDataGridµÄEmployeeList_BeginningCellEditʼþ½«µ±Ç°Ñ¡È¡µÄÊý¾ÝÐÐÐÅÏ¢·µ»Øµ½ ......