Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascript RegExp¶ÔÏóÊôÐÔÓë·½·¨ºÍÓ¦ÓÃ

RegExp¶ÔÏó£¨ÖÁ½ñΪֹÎÒ¿´µ½¹ýµÄ×îͨË×Ò׶®ºÍÉîÈëµÄÕýÔò±í´ïʽ½Ì³Ì£©
JavaScriptÌṩÁËÒ»¸öRegExp¶ÔÏóÀ´Íê³ÉÓйØÕýÔò±í´ïʽµÄ²Ù×÷ºÍ¹¦ÄÜ£¬Ã¿Ò»ÌõÕýÔò±í´ïʽģʽ¶ÔÓ¦Ò»¸öRegExpʵÀý¡£ÓÐÁ½ÖÖ·½Ê½¿ÉÒÔ´´½¨RegExp¶ÔÏóµÄʵÀý¡£
      ʹÓÃRegExpµÄÏÔʽ¹¹Ô캯Êý£¬Ó﷨Ϊ£ºnew RegExp("pattern"[,"flags"])¡£
      ʹÓÃRegExpµÄÒþʽ¹¹Ô캯Êý£¬²ÉÓô¿Îı¾¸ñʽ£º/pattern/[flags]¡£
pattern²¿·ÖΪҪʹÓõÄÕýÔò±í´ïʽģʽÎı¾£¬ÊDZØÐëµÄ¡£ÔÚµÚÒ»ÖÖ·½Ê½ÖУ¬pattern²¿·ÖÒÔJavaScript×Ö·û´®µÄÐÎʽ´æÔÚ£¬ÐèҪʹÓÃË«ÒýºÅ»òµ¥ÒýºÅÀ¨ÆðÀ´£»ÔÚµÚ¶þÖÖ·½Ê½ÖУ¬pattern²¿·ÖǶÌ×ÔÚÁ½¸ö“/”Ö®¼ä£¬²»ÄÜʹÓÃÒýºÅ¡£
flags²¿·ÖÉèÖÃÕýÔò±í´ïʽµÄ±êÖ¾ÐÅÏ¢£¬ÊÇ¿ÉÑ¡Ïî¡£Èç¹ûÉèÖÃflags²¿·Ö£¬ÔÚµÚÒ»ÖÖ·½Ê½ÖУ¬ÒÔ×Ö·û´®µÄÐÎʽ´æÔÚ£»ÔÚµÚ¶þÖÖ·½Ê½ÖУ¬ÒÔÎı¾µÄÐÎʽ½ô½ÓÔÚ×îºóÒ»¸ö“/”×Ö·ûÖ®ºó¡£flags¿ÉÒÔÊÇÒÔϱêÖ¾×Ö·ûµÄ×éºÏ¡£
      gÊÇÈ«¾Ö±êÖ¾¡£Èç¹ûÉèÖÃÁËÕâ¸ö±êÖ¾£¬¶Ôij¸öÎı¾Ö´ÐÐËÑË÷ºÍÌæ»»²Ù×÷ʱ£¬½«¶ÔÎı¾ÖÐËùÓÐÆ¥ÅäµÄ²¿·ÖÆð×÷Óá£Èç¹û²»ÉèÖÃÕâ¸ö±êÖ¾£¬Ôò½öËÑË÷ºÍÌæ»»×îÔçÆ¥ÅäµÄÄÚÈÝ¡£
      iÊǺöÂÔ´óСд±êÖ¾¡£Èç¹ûÉèÖÃÁËÕâ¸ö±êÖ¾£¬½øÐÐÆ¥Åä±È½Ïʱ£¬½«ºöÂÔ´óСд¡£
      mÊǶàÐбêÖ¾¡£Èç¹û²»ÉèÖÃÕâ¸ö±êÖ¾£¬ÄÇôԪ×Ö·û“^”Ö»ÓëÕû¸ö±»ËÑË÷×Ö·û´®µÄ¿ªÊ¼Î»ÖÃÏàÆ¥Å䣬¶øÔª×Ö·û“$”Ö»Óë±»ËÑË÷×Ö·û´®µÄ½áÊøλÖÃÏàÆ¥Åä¡£Èç¹ûÉèÖÃÁËÕâ¸ö±êÖ¾£¬“^”»¹¿ÉÒÔÓë±»ËÑË÷×Ö·û´®Öеē\n”»ò“\r”Ö®ºóµÄλÖ㨼´ÏÂÒ»ÐеÄÐÐÊ×£©ÏàÆ¥Å䣬¶ø“$”»¹¿ÉÒÔÓë±»ËÑË÷×Ö·û´®Öеē\n”»ò“\r”Ö®ºóµÄλÖ㨼´ÏÂÒ»ÐеÄÐÐ⣩ÏàÆ¥Åä¡£
´úÂë8.1ÊÇÒ»¸ö´´½¨ÕýÔò±í´ïʽµÄÀý×Ó¡£
´úÂë8.1   ´´½¨ÕýÔò±í´ïʽ£º8.1.htm
<html>
<head>
<title>´´½¨ÕýÔò±í´ïʽ </title>
<script language = "JavaScript">
       var myString="ÕâÊǵÚÒ»¸öÕýÔò±í´ïʽµÄÀý×Ó";
       var myregex = new RegExp("Ò»¸ö");   // ´´½¨ÕýÔò±í´ïʽ
       if (myregex.test(myString)){
      


Ïà¹ØÎĵµ£º

JavaScript¼ò½é

JavaScript         ECMAScriptÊÇÕâ¸ö½Å±¾ÓïÑԵıê×¼»¯°æ±¾¡£ ScriptÔªËØ£º             ÔÚHTML´úÂëÖÐÌí¼ÓJavaScript´úÂë             Ò²¿ÉÒ԰ѽű¾´úÂë·ÅÔ ......

ÓÃJavaScriptʵÏÖä¯ÀÀÆ÷״̬À¸·ÉÈëÎÄ×Ö

 //״̬À¸·ÉÈëÎÄ×Ö
function statusMessageObject(p,d) {  <!--????????????-->
  this.msg = MESSAGE
  this.out = " "
  this.pos = POSITION
  this.delay = DELAY
  this.i     = 0
  this.reset = clearMessage
}
function clearMessage( ......

JavaScript TextBoxÊäÈëÊý×Ö¿ØÖÆ

var OnPasteCheckIntNum = function()
{
    if(window.clipboardData)
    {
        if(isNaN(window.clipboardData.getData('text')))
        {
          ......

·þÎñÆ÷¶Ëjavascriptµ¯³ö¶Ô»°¿òºÍÎļþ¡¢Ä¿Â¼²Ù×÷

//·þÎñÆ÷µ¯³ö¶Ô»°¿ò
 if (lcSID == "1" && (txtNsp.Text.Trim() != lcNewspaper || Convert.ToDateTime(txtNspdate.Text.Trim()) != Convert.ToDateTime(lcNspdate)))
        {
            string lcJs = "v ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ