Re: Powershell regex

2010-01-15 Thread Steven Peck
and randomly linking to a recently read blog post that may be of interest to you. http://karlprosser.com/coder/2010/01/11/replacing-many-grouped-regular-expression-matches-in-powershell/ On Fri, Jan 15, 2010 at 9:22 AM, Joseph L. Casale wrote: >>For example, how can I actually do multiple regex'

RE: Powershell regex

2010-01-15 Thread Joseph L. Casale
>For example, how can I actually do multiple regex's on one line Looks like -Replace handles actual regex's, that made things cleaner... ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ ~

RE: Powershell regex

2010-01-15 Thread Joseph L. Casale
>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". Cool, I shoul

RE: Powershell regex

2010-01-15 Thread Michael B. Smith
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]::Replac