troubleshooting Question

Modify Powershell Script to remove asterisk from HTML file

Avatar of E=mc2
E=mc2 asked on
PowershellHTMLScripting Languages
3 Comments1 Solution13 ViewsLast Modified:
I would like to modify this Powershell script to remove an asterisk which is appearing in the html file.

The current error I am getting is:

The regular expression pattern * is not valid.
At C:\Users\User1\Desktop\Report.ps1:39 char:1
+ ((Get-Content -path $writeto -Raw) -replace $oldcontent,$newcontent)  ...

$oldcontent = '*'
$newcontent = '<span style="color: rgb(51, 102, 255); font-weight: bold;"'
$writeto = 'C:\Users\User1\Desktop\Report.html'

((Get-Content -path $writeto -Raw) -replace $oldcontent,$newcontent) | Set-Content -Path $writeto

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros