That's not a regular expression! That's just System.String.Replace().
So....
$strLog = ($path.Replace("/$", "")).Replace("/", "_") + '.log"'
If you actually meant "/$" as a regex, so that it removes the last character of
$path, if it's a /, you can keep that and do:
$strLog = ([regex]::Replace($path, "/$", '')).Replace('/','_') + '.log'
So, if $path = "/cygwin/c/windows/", then $strLog = "_cygwin_c_windows.log".
-----Original Message-----
From: Joseph L. Casale [mailto:[email protected]]
Sent: Thursday, January 14, 2010 7:11 PM
To: NT System Admin Issues
Subject: Powershell regex
Is it possible to do more than one regex in the same command?
$strLog = [regex]::Replace($path, "/$", '') $strLog = [regex]::Replace($strLog,
'/', '_') + ".log" + '"'
That's looks hideous:)
Thanks!
jlc
~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~
<http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~