Skip to content

Instantly share code, notes, and snippets.

@martin9700
Created March 23, 2015 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martin9700/d7cd8d8fa2d8929e51ee to your computer and use it in GitHub Desktop.
Save martin9700/d7cd8d8fa2d8929e51ee to your computer and use it in GitHub Desktop.
If ($Line -like "*<td>*")
{
#Check the column for a value change, and if so swap the designated class
$Search = $Line | Select-String -Pattern "<td>.*?</td>" -AllMatches
If ($LastColumn -ne $Search.Matches[$Index].Value)
{
If ($Class -eq $CSSEvenClass)
{
$Class = $CSSOddClass
}
Else
{
$Class = $CSSEvenClass
}
}
$LastColumn = $Search.Matches[$Index].Value
$Line = $Line.Replace("<tr>","<tr class=""$Class"">")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment