Author Posts

August 22, 2018 at 4:05 pm

Hopefully this sounds worse than it is.

$PSItem -replace "\d{1,4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2},\d{1,3}\sSomeUniqueText

I want to use the above string but only change "td" to td style='background-color:#FF8080' leaving the original data defined by \d{1,4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2},\d{1,3}\sSomeUniqueText as it is.

Long story short I need the whole string to define where to change but only want to change a piece of it leaving the rest alone.

August 22, 2018 at 4:08 pm

ok its not populating right, its removing the html tag characters

August 22, 2018 at 4:13 pm

$PSItem -replace "td\d{1,4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2},\d{1,3}\sSomeUniqueText"

just picture the td as having html tags on it i guess

August 22, 2018 at 4:58 pm

Not able to understand your question. What problem are you facing ?

Note: When you have update t your own post before anyone replies, please do the update using the edit option in the same post.

August 22, 2018 at 5:05 pm

the forum is removing the characters you get when you hold shift and press , or .. its not letting me put the whole string in here. is there an escape character for this forum

August 22, 2018 at 5:27 pm

Well found a way to do what I was trying to express. here is what I did

if ($PSItem -match "td\d{1,4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2},\d{1,3}\sSomeUniqueText) { 
$PSItem -replace "td", "td style='background-color:#FF8080'" }Else {$_}

the td is an html tag but it wont let me put the symbols on it in the forum

August 22, 2018 at 5:32 pm

@PJ – HTML or XML you need to use Gist