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

LINUX C++ REGEXP ÕýÔò±í´ïʽ

ÔÚPOSIXÖУ¬±ãÓÐ×ÅÖ§³ÖÕýÔò±í´ïʽµÄϵͳº¯Êý¡£GNU/LinuxÓÐÁ½Ì׿â¿ÉÓÃÓÚÕýÔò±í´ïʽ±à³Ì£ºPOSIX¿âºÍPCRE¿â¡£Ç°Õß²»ÐèÒªµ¥¶À°²×°£¬Ò»°ãÐèÇó»¹ÊÇÄÜÂú×ãµÄ£¬ËÙ¶ÈÉÔÂýЩ¡£ºóÕßÊǾøºÊ¢ÃûµÄPerlÕýÔò±í´ïʽ¿â£¬¹¦ÄÜÇ¿´ó£¬Æ¥ÅäËٶȿ죬²»¹ý¿ÉÄÜÐèÒªµ¥¶À°²×°¡£
int regcomp (regex_t *compiled, const char *pattern, int cflags)
    
²ÎÊýcompiledÖ»ÓÐÒ»¸ö³ÉÔ±ÊÇÎÒÃÇÐèÒª¹Ø×¢µÄ£¬ÄǾÍÊÇre_nsub£¬´ú±í±àÒëºóµÄ×Ó±í´ïʽÊýÄ¿£¬ÓÉÓÚÎÒÃÇ»¹ÐèÒª±£´æÕû¸öÆ¥Åäµ½µÄģʽ£¬ËùÒÔ×îÖÕÆ¥ÅäµÄÌõÄ¿ÊýÊÇre_nsub¼Ó1¡£cflagsÓÃÀ´ÐÞÊÎÆ¥Åäģʽ£¬¿ÉÈ¡ÖµÈçÏ£º
REG_EXTENDED ÆôÓÃPOSIXÕýÔò¿âÀ©Õ¹£¬¹ØÓÚ¸ÃÀ©Õ¹µÄÏêϸÐÅÏ¢¿É²Î¿¼POSIX¹æ·¶
REG_ICASE ºöÂÔ´óСд
REG_NOSUB ²»Òª´æ´¢×Ó±í´ïʽ
REG_NEWLINE °Ñ»»Ðзû×÷Ϊ¶àÐеķָô·û£¬ÕâÑù'$'¿ÉÆ¥ÅäÿһÐеÄÐÐ⣬'^'Æ¥ÅäÿһÐеÄÐÐÊ×£¬'.'²»Æ¥Åä»»Ðзû£¬[^...]²»Æ¥ÅäÐÂÐС£
²ÎÊýregexÊÇÒ»¸ö×Ö·û´®£¬Ëü´ú±í½«Òª±»±àÒëµÄÕýÔò±í´ïʽ;²ÎÊýpregÖ¸ÏòÒ»¸öÉùÃ÷Ϊregex_tµÄÊý¾Ý½á¹¹£¬ÓÃÀ´±£´æ±àÒë½á¹û;²ÎÊýcflags¾ö¶¨ÁËÕýÔò±í´ïʽ¸ÃÈçºÎ±»´¦ÀíµÄϸ½Ú¡£
¡¡¡¡Èç¹ûº¯Êýregcomp()Ö´Ðгɹ¦£¬²¢ÇÒ±àÒë½á¹û±»ÕýÈ·Ìî³äµ½pregÖк󣬺¯Êý½«·µ»Ø0£¬ÈκÎÆäËüµÄ·µ»Ø½á¹û¶¼´ú±íÓÐijÖÖ´íÎó²úÉú¡£
¡¡¡¡Æ¥ÅäÕýÔò±í´ïʽ
¡¡¡¡Ò»µ©ÓÃregcomp()º¯Êý³É¹¦µØ±àÒëÁËÕýÔò±í´ïʽ£¬½ÓÏÂÀ´¾Í¿ÉÒÔµ÷ÓÃregexec()º¯ÊýÍê³ÉģʽƥÅ䣺
±àÒëÍêģʽºóÎÒÃÇ´ÓÄÚ´æÖзÖÅä×Ó±í´ïʽ´æ´¢¿Õ¼ä£¬È»ºóµ÷ÓÃregexec¶Ô´®½øÐÐÆ¥Å䣬¸Ãº¯ÊýÔ­ÐÍÈçÏ£º
int regexec (regex_t *compiled, char *string, size_t nmatch, regmatch_t matchptr [], int eflags)
nmatchÖ¸Ã÷matchptrÊý×éµÄÊýÄ¿£¬¸ÃÊýÄ¿ÊÇcompiled->re_nsub+1£¬Ò²¿ÉÒÔÈÃnmatchΪ0,matchptrΪNULL£¬±íʾ²»Òª±£´æ×Ó±í´ïʽ¡£eflagsͨ³£Îª0¡£
²ÎÊýpregÖ¸Ïò±àÒëºóµÄÕýÔò±í´ïʽ£¬²ÎÊýstringÊǽ«Òª½øÐÐÆ¥ÅäµÄ×Ö·û´®£¬¶ø²ÎÊýnmatchºÍpmatchÔòÓÃÓÚ°ÑÆ¥Åä½á¹û·µ»Ø¸øµ÷ÓóÌÐò£¬×îºóÒ»¸ö²ÎÊýeflags¾ö¶¨ÁËÆ¥ÅäµÄϸ½Ú¡£
¡¡¡¡ÔÚµ÷Óú¯Êýregexec()½øÐÐģʽƥÅäµÄ¹ý³ÌÖУ¬¿ÉÄÜÔÚ×Ö·û´®stringÖлáÓжദÓë¸ø¶¨µÄÕýÔò±í´ïʽÏàÆ¥Å䣬²ÎÊýpmatch¾ÍÊÇÓÃÀ´±£´æÕâЩƥÅäλÖõģ¬¶ø²ÎÊýnmatchÔò¸æËߺ¯Êýregexec()×î¶à¿ÉÒ԰ѶàÉÙ¸öÆ¥Åä½á¹ûÌî³äµ½pmatchÊý×éÖС£µ±regexec()º¯Êý³É¹¦·µ»Øʱ£¬´Óstring+pmatch[0].rm_soµ½string+pmatch[0].rm_eoÊǵÚÒ»¸öÆ¥ÅäµÄ×Ö·û´®£¬¶ø´Óstring+pmatch[1].rm_soµ½string+pmatch[1].rm_eo£¬ÔòÊǵÚ


Ïà¹ØÎĵµ£º

linuxÄں˶ÁÊé±Ê¼Ç£¨½ø³ÌÖÕÖ¹º¯Êý·ÖÎö£©Èý

do_exit() Function
-----------------------------------------------------------------------
kernel/exit.c
707 NORET_TYPE void do_exit(long code)
708 {
709 struct task_struct *tsk = current;
710
711 if (unlikely(in_interrupt()))
712 panic("Aiee, killing interrupt handler!");
713 if ......

linuxϵͳµ÷ÓÃÁбí

Ò»¡¢½ø³Ì¿ØÖÆ£º
fork
´´½¨Ò»¸öнø³Ì
clone
°´Ö¸¶¨Ìõ¼þ´´½¨×Ó
½ø³Ì
execve
ÔËÐпÉÖ´ÐÐÎļþ
exit
ÖÐ
Ö¹½ø³Ì
_exit
Á¢¼´ÖÐÖ¹µ±Ç°½ø³Ì
getdtablesize
½ø
³ÌËùÄÜ´ò¿ªµÄ×î´óÎļþÊý
getpgid
»ñÈ¡Ö¸¶¨½ø³Ì×é±êʶºÅ
setpgid
Éè
ÖÃÖ¸¶¨½ø³Ì×é±êÖ¾ºÅ
getpgrp
»ñÈ¡µ±Ç°½ø³Ì×é±êʶºÅ
setpgrp
Éè
Öõ±Ç°½ø³Ì×é± ......

¹ØÓÚLinuxµÄÊé¼®

Linux²¢²»ÊÇÒ»¸ö±Èwindows¸üÉñÃصÄϵͳ.
ÊǵÄLinuxûÓÐMSDN,µ«LinuxºÍÏà¹ØÈí¼þµÄÎĵµ¾ø¶Ô²»±ÈMSDNÒªÉÙ
¼ÇµÃ,Ò»¸ö¿´¹Ù·½ÍøÕ¾µÄÎĵµ,Ò»¸ögoogle.ÎÒÏë,´ó¶àÎÊÌⶼ»á½â¾öµÄ.ʣϵľͿ¿
Ä㶯ÊÖ½â¾öÁË.
linuxÈëÃÅ:
ûÓз¢ÏÖʲô±È½ÏºÃµÄÈëÃÅÊé,Ҫô̫¹ÅÀÏ,ҪôÕÕ¹ËÌ«¶àµÄ·ÅÐа汾,µ¼ÖÂûÓÐʲô
ʵ¼ÊÓô¦.ʵ¼ÊÉÏ,²Î¿¼·¢ÐÐ°æµ ......

Linux ÄÚºËÖÐµÄ GCC ÌØÐÔ(ת)

M. Tim Jones, ¹ËÎʹ¤³Ìʦ, Emulex Corp.
2009 Äê 4 ÔÂ 07 ÈÕ
Linux® ÄÚºËʹÓà GNU Compiler Collection (GCC) Ì×¼þµÄ¼¸¸öÌØÊ⹦ÄÜ¡£ÕâЩ¹¦ÄÜ°üÀ¨Ìṩ¿ì½Ý·½Ê½ºÍ¼ò»¯ÒÔ¼°Ïò±àÒëÆ÷ÌṩÓÅ»¯ÌáʾµÈµÈ¡£Á˽âÕâЩÌØÊâµÄ GCC ÌØÐÔ£¬Ñ§Ï°ÈçºÎÔÚ Linux ÄÚºËÖÐʹÓÃËüÃÇ¡£
GCC ºÍ Linux ÊdzöÉ«µÄ×éºÏ¡£¾¡¹ÜËüÃÇÊǶÀÁ¢µÄÈí¼þ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ