Hi all,
I need to match string from {=BeginCatRecords=} to {=EndCatRecords=}....
Here is the HTML code from a file (categories.html), I a reading in a variable st :
<TABLE width="100%" border="0" align="center" cellpadding="0" cellSpacing=0 > <TR valign="top" > {=BeginCatRecords=}<TD width="45%" align='center' style='border:1px #F4EED4 solid;'><Table align='center' border="0"><tr><td align='center' style="padding-top:15px;"><a href="{=CatLink=}"><IMG SRC="images/category/{=CatImg=}" border="0" width="150"></a><BR><a href="{=CatLink=}" class='catlinks'><strong>{=CatName=}</a></strong></td></tr><tr><td><table width="90%" border='0' align="center" cellpadding="0" cellSpacing=0><tr><td align='left'>{=CatDesc=}</td></tr></table></td></tr></table></td><td width='5%'> </td>{=EndCatRecords=} </TR> <TR><TD colspan='2'> </TD></TR></TABLE>
In this file, from {=BeginCatRecords=} to {=EndCatRecords=} is written in one line.. and it is working fine...
But if I split it in multiline like :
{=BeginCatRecords=}<TD width="45%" align='center' style='border:1px #F4EED4 solid;'><Table align='center' border="0"> <tr><td align='center' style="padding-top:15px;"><a href="{=CatLink=}"><IMG SRC="images/category/{=CatImg=}" border="0" width="150"></a><BR><a href="{=CatLink=}" class='catlinks'><strong>{=CatName=}</a></strong></td></tr><tr><td><table width="90%" border='0' align="center" cellpadding="0" cellSpacing=0><tr><td align='left'>{=CatDesc=}</td></tr></table></td></tr></table></td><td width='5%'> </td>{=EndCatRecords=}
It stops working...
Below is the code I am using to match the string :
string NavMatch = null;pattern = @"{=BeginCatRecords=}.*?{=EndCatRecords=}";Match MatchTop = Regex.Match(st, pattern, RegexOptions.Multiline);NavMatch = MatchTop.ToString();
I suppose, I need to change either the pattern or I am missing any option while matching the string...
If you have any other logic to do the needful, please let me know..
Please help..
Suman Singh