匹配 C 语言样式字符串

 1 #include <stdio.h>
 2 
 3 char haha[] = "nihaoma"
 4               "niubi"
 5                "\"hello world\n\"";
 6 int main(void)
 7 {
 8     printf("%s\n", haha);
 9     return 0;
10 }

匹配的正则表达式如下

(("(\\.|[^"])*")\s*)+

 

posted @ 2014-10-29 16:00  WendellYih  阅读(191)  评论(0编辑  收藏  举报