fertigj
asked on
Powershell Regular Expression script question
I am trying to write a script to read in a test file, search for just the user and return that.
SOMEDOMAIN\SomeUser Full Control[aasdfa]
SOMEDOMAIN\SomeUser Partial Control[aasdfa]
SOMEDOMAIN\SomeUser Full Control[aasdfa]
I have some of the code needed and I also have the a regex statement that works. I am getting caught on the output of $Matches
When I run the code and check $matches is only contains the last item found/returned.
I know I am missing something simple, any insight would be appreciated :)
SOMEDOMAIN\SomeUser Full Control[aasdfa]
SOMEDOMAIN\SomeUser Partial Control[aasdfa]
SOMEDOMAIN\SomeUser Full Control[aasdfa]
I have some of the code needed and I also have the a regex statement that works. I am getting caught on the output of $Matches
When I run the code and check $matches is only contains the last item found/returned.
I know I am missing something simple, any insight would be appreciated :)
Get-Content file.txt |where-object{$_ -match '\S*\s'}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When I do this I get nothing back. Thoughts?