C正则库,二为perl正则库PCRE。相比较而言PCRE要强大些,POSIX
C正则库就足够使用。下面,这几个链接里面有网页分析的一些例子,虽然不都是C语言来处理的。但是,思路都是一致的。
所以,说到底,还是正则表达式、正则函数库、字符串处理函数这些才是根本。先说这些,希望对你有所帮助。如果你在学习过程中还有什么问题,欢迎随时交流:)C#的: http://www.jb51.net/article/16618.htmC#的: http://mytiu.blog.163.com/blog/static/1059718452009127112226478/这里还有一段C语言的代码,
是将下载下来的网页源代码处理成没有标签的纯文字文本#include
<tidy.h>#include
<buffio.h>#include
<stdio.h>#include
<errno.h>int
main(int
argc,
char
**argv
){const
char*
input
=
"<title>Foo</title>
Foo!"TidyBuffer
output
=
{0}TidyBuffer
errbuf
=
{0}int
rc
=
-1Bool
okTidyDoc
tdoc
=
tidyCreate()
//
Initialize
"document"printf(
"Tidying:\t%s\n",
input
)ok
=
tidyOptSetBool(
tdoc,
TidyXhtmlOut,
yes
)
//
Convert
to
XHTMLif
(
ok
)rc
=
tidySetErrorBuffer(
tdoc,
&errbuf
)
//
Capture
diagnosticsif
(
rc
>=
0
)rc
=
tidyParseString(
tdoc,
input
)
//
Parse
the
inputif
(
rc
>=
0
)rc
=
tidyCleanAndRepair(
tdoc
)
//
Tidy
it
up!if
(
rc
>=
0
)rc
=
tidyRunDiagnostics(
tdoc
)
//
Kvetchif
(
rc
>
1
)
//
If
error,
force
output.rc
=
(
tidyOptSetBool(tdoc,
TidyForceOutput,
yes)
?
rc
:
-1
)if
(
rc
>=
0
)rc
=
tidySaveBuffer(
tdoc,
&output
)
//
Pretty
Printif
(
rc
>=
0
){if
(
rc
>
0
)printf(
"\nDiagnostics:\n\n%s",
errbuf.bp
)printf(
"\nAnd
here
is
the
result:\n\n%s",
output.bp
)}elseprintf(
"A
severe
error
(%d)
occurred.\n",
rc
)tidyBufFree(
&output
)tidyBufFree(
&errbuf
)tidyRelease(
tdoc
)return
rc}
C语言是以它的高效性著称的,一般使用在嵌入式等对系统高效性要求比较高的系统当中,也会用它来写一些window或者linux下的应用。但是它不能做网站,现在流行的做网站项目的语言是C#和java,php等等。