Trying to compare string return by regex from hash table

rated by 0 users
Not Answered This post has 0 verified answers | 1 Reply | 1 Follower

Not Ranked
2 Posts
Nicky posted on 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



All Replies

Top 10 Contributor
655 Posts
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.