<div id=\"TextTitle\"><span class=\"newstitle\">hello ,world</span></div>我想提取上面这句话中间的<span class=\"newstitle\">hello ,world</span>,想使用正则表达式,利用VC.net自己提供的CAtlRegEx完成,希望有达人帮我,对这个类我不是很熟,试验了很久总也提取不出来,谢谢了
解决方案 »
- 能不能完成VC对excel数据处理并显示表格图像??
- 3年没来了,散个分:0,前辈们出来赏个脸:)
- ccombobox::deletestring异常
- CoUninitialize()执行完,函数返回时出错,请帮助!
- 怎么得到某个磁盘下所有的文件夹
- 我想在对话框设定picture控件的宽度和高度? 如何去设置? 比如我想让宽等于 120, 高等于120.
- 组播是不是只能用UDP协议,不能用TCP协议?
- 请教
- 请问关于IP及端口号的问题
- [讨论~大的~]StreamBoxVCR一类软件的原理是什么?谁能告诉我~UP有分~
- _stdcall与_cdecl的作用,是说明如何清空堆栈. 那堆栈里有哪些数据呢,什么时候会用到堆栈
- 工作
CAtlRegExp<> reContent;
// Five match groups: scheme, authority, path, query, fragment
REParseError status = reContent.Parse(
L"<span.*span>" ); if (REPARSE_ERROR_OK != status)
{
// Unexpected error.
return;
} CAtlREMatchContext<> mcUrl;
if (!reContent.Match(
L"<div id=\"TextTitle\"><span class=\"newstitle\">hello, world</span></div>",
&mcUrl))
{
// Unexpected error.
return;
}
wchar_t l[200];
CString str;
for (UINT nGroupIndex = 0; nGroupIndex < mcUrl.m_uNumGroups;
++nGroupIndex)
{
const CAtlREMatchContext<>::RECHAR* szStart = 0;
const CAtlREMatchContext<>::RECHAR* szEnd = 0;
reContent.GetMatch(nGroupIndex, &szStart, &szEnd); ptrdiff_t nLength = szEnd - szStart;
//str.Append(CStr(
swprintf_s(l,L"%d: \"%.*s\"\n", nGroupIndex, nLength, szStart);
str.Append(CString(l));
} // return; MessageBox(str);
最后显示出来的总是空,不解
<span><div id=\"TextTitle\"> <span class=\"newstitle\">hello ,world </span> </div></span>