×Ô¼º¶¯ÊÖдһ¸öÅжÏÍøÖ·ºÏ·¨µÄC\C++µÄÕýÔò±í´ïʽ³ÌÐò
#include<stdio.h>
#include<regex.h>
int main(int argc, char** argv)
{
if(IsLegalPage("http://www.baidu.com"))
printf("¸ÃÍøÒ³ºÏ·¨\n");
else printf("¸ÃÍøÒ³²»ºÏ·¨£¡£¡£¡\n");
return 0;
}
/* º¯Êý˵Ã÷£ºÅжÏÍøÒ³ÊÇ·ñºÏ·¨
* ÊäÈë²ÎÊý£ºÐèÒªÅжϵÄÍøÖ·
* ·µ»Ø½á¹û£ºÍøÒ³ÊÇ·ñºÏ·¨(ºÏ·¨1£¬²»ºÏ·¨0)
*/
int IsLegalPage(char* s_tmp)
{
char* pattern="(https?)://.*(\.cn|\.com|\.htm|\.html|\.aspx?|\.jsp|\.php|/|/#)$";
printf("pattern=%s\n",pattern);
int z=0;
regex_t reg;
regmatch_t pm[1];
z=regcomp(®,pattern,REG_EXTENDED|REG_ICASE);
z=regexec(®,s_tmp,1,pm,0);
if(z!=0)
return 0;
else
return 1;
regfree(®);
}
Ïà¹ØÎĵµ£º
λ¼ÆÊý¾ÍÊǶÔÒ»¸öÊýÖоßÓÐijЩÌØÕ÷µÄλ½øÐмÆÊý¡£¿´ÏÂÃæʵÏÖ£º
/* bitscount.c£ºÎ»¼ÆÊý */
/* ¼ÆËãxÖÐ1λµÄÊýÄ¿£º·½°¸1£¬²ÉÓ÷ÖÖβßÂÔ */
inline int pop(unsigned x){
/* ¶Ôÿ¸ö2λ×ֶΣ¬ÏÈÎö³öÆäÓҶ˵Ä1룬ÔÙÎö³öÆä×ó¶ËµÄ1λ£¬È»ºóÈÃÕâÁ½¸öλÏà¼Ó */
x=(x & 0x55555555)+((x>>1) & 0x555555 ......
×¢ÒâÖ»Äܵ½2049Ä꣡
#define uchar unsigned char
#define uint unsigned int
#include <intrins.h>
/*
¹«ÀúÄê¶ÔÓ¦µÄÅ©ÀúÊý¾Ý,ÿÄêÈý×Ö½Ú,
¸ñʽµÚÒ»×Ö½ÚBIT7-4 λ±íʾÈòÔÂÔ·Ý,ֵΪ0 ΪÎÞÈòÔÂ,BIT3-0 ¶ÔӦũÀúµÚ1-4 ÔµĴóС
µÚ¶þ×Ö½ÚBIT7-0 ¶ÔӦũÀúµÚ5-12 Ô´óС,µÚÈý×Ö½ÚBIT7 ±íʾũÀúµÚ13 ¸öÔ´óÐ ......
1.1Çë¸ù¾Ý×Ô¼ºµÄÈÏʶ£¬Ð´³öCÓïÑÔµÄÖ÷ÒªÌص㡣
1.2CÓïÑÔµÄÖ÷ÒªÓÃ;ÊÇʲô£¿ËüºÍÆäËû¸ß¼¶ÓïÑÔÓÐʲôÒìͬ£¿
1.3д³öÒ»¸öC³ÌÐòµÄ¹¹³É¡£
1.4CÓïÑÔÒÔº¯ÊýΪ³ÌÐòµÄ»ù±¾µ¥Î»£¬ÓÐʲôºÃ´¦£¿
1.5Çë²ÎÕÕ±¾ÕÂÀýÌ⣬±àдһ¸öC³ÌÐò£¬Êä³öÒ»ÏÂÐÅÏ¢£º
×××××××××××& ......
ÔÚGmail TopLanguage Group Öп´µ½Ò»ÆªÎÄÕ“C/C++³ÌÐòÔ±±Ø¶ÁµÄÊ®±¾Ê飨ÉÏ£©”£¬´ó¼ÒµÄÌÖÂÛ¶¼ºÜ¼¤Àø£¬´ó¼Ò¶¼¾õµÃÕâƪÎÄÕÂдµÃºÜ°ô£¬ÎÒÏëÔÚGroupÀïµÄÅóÓѶ¼ÄÜÔÚLookgirlµÄÕâƪÎÄÕÂÀï»ñÒæ²»ÉÙ£¬Îª´Ë¶·µ¨ÔÚ´ËתÔظÃÎÄ£¬¹©¸ü¶àÅóÓѽ»Á÷¡¢Ñ§Ï°¡£
C/C++³ÌÐòÔ±±Ø¶ÁµÄÊ®±¾Ê飨ÉÏ£©
Õâ¸öÌâÄ¿´óµÄÓÐЩÀëÆ×£¬Êµ»°Ëµ£ ......
HTTP·ÖΪÇëÇóÐУ¬ÇëÇóÍ·²¿ÒÔ¼°ÇëÇóÄÚÈÝ
ÄǸö³¤¶ÈÊý×ÖÖµ¾ÍÊÇÇëÇóÄÚÈݵij¤¶È£¨×Ö½ÚΪµ¥Î»£©
¸øÒ»¶ÎÀý×ÓÄã¾Í»ù±¾Ã÷°×ÁË:
onst CString getString(int i)
{
CString s;
s.Format(_T("%d"), i);
return s;
}
////////////////////////////////
CS ......