Trying to compare string return by regex from hash table

rated by 0 users
This post has 1 Reply | 1 Follower

Not Ranked
Posts 2
Nicky Posted: 04-02-2012 7:01 AM



I'm beginning to write some PowerShell scripts to check log files.

I'm working with 2 hash tables $ini and $ini2 with is put inside $ini


I try to use the following command line to put a regex in a variable :

$base_folder = ([regex]"([_\w:\\]*)").matches($ini.$ini2["base"]) | foreach {$_.Groups[1].Value}

$check = Test-Path -path $base_folder

echo "--$base_folder--"

$base_folder is returning something like --  D:\data\dump_base   --


I'm getting some space witch or not present in the source file :



Thanks in advance



Top 10 Contributor
Posts 655
Microsoft MVP
Top Contributor

you could try this:

...foreach {$_.Groups[1].Value.Trim()}

Page 1 of 1 (2 items) | RSS
Copyright 2012 All rights reserved.