Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

-Replace v .Replace 1

Status
Not open for further replies.

mrmovie

Technical User
Oct 2, 2002
3,094
GB
Being new to powershell this was doing me in.
I was using:

$strResult = $strResult -Replace($strX, $strY)

this was working most of the time, however if $strX started with a 'funny' char ^ or # (i think) this replace function was no longer working, i presume it was thinking $strX was a regexp or something like that?

I have found that:

$strResult = $strResult.Replace($strX, $strY)

gives me the result i want

I Hear, I Forget
I See, I Remember
I Do, I Understand

Ronald McDonald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top