Posts

Showing posts from June, 2010

Powershell –replace method and my own frustration.

Summary:
I added some code to my VMWare Infrastructure script for a new column of data to show a tooltip when clicked or hovered over.  Because I also have it export a csv file from this code, I use the –replace method to strip the html formatting.  Because of one section, more data than I wanted was being stripped.  Why?  Probably because I used this: .*>
Resolution:
Anyway here is the string I was using:
1: foreach {$_ -replace("<p style='font-weight:bold;color:orange'>","") -replace("<p style='font-weight:bold;color:red'>","") -replace("<a class='cluster' href=./healthcheck.htm#.*> ","") -replace("</p>","") -replace ("</a>","") -replace ("<a href='#' class='tt'>","") -replace ("<span class='tooltip'><span class='top'></span><span class='…