Hi All,
I'm having a bit of trouble with regex's (C#, ASP.NET), and I'm pretty sure I'm doing something fundamentally wrong. My task is to bind a dynamically created gridview to a datasource, and then iterate through a column in the grid, looking for the string "A&I". An example of what the data in the cell (in template column) looks like is:
Name:
John Doe
Phone: 555-123-1234
Email:
john[email protected]
Dept: DHS-A&I-MRB
Here's the code I'm using to find the string value:
foreach(GridViewRow gvrow in gv.Rows)
{
Match m = Regex.Match(gvrow.Cells[6].Text,"A&I");
if(m.Success)
{
gvrow.ForeColor = System.Drawing.Color.Red;
}
}
I'm not having any luck with any of these variations:
"A&I"
"[A][&][I]"
But when I strictly user "&", the row does turn red. Any suggestions?
Thanks, Dan