Solved

Powershell regular expression

Posted on 2011-03-07
2
1,252 Views
Last Modified: 2012-05-11
Hello,

Pls would you advise in this case? In description there is string which contains a date in format "dd.mm.yyyy", I am trying to extract it .

Please would you advice how to save it into variable. I am not sure where I am doing mistake.

I am getting error :   "Expressions are only allowed as the first element of a pipeline."

$mailbox = Get-QADUser -Enabled 'xxx' -IncludedProperties name,description,accountexpires

$test = $mailbox | if ($_.description -ne $null){ [regex]::Match($_.description,"\d{2}\W\d{2}\W\d{4}")}

write $test.value


Many thanks
0
Comment
Question by:Radim88
  • 2
2 Comments
 

Accepted Solution

by:
Radim88 earned 0 total points
Comment Utility
thx

$mailbox = Get-QADUser -Enabled 'CZPRG TFSCalendar'

$test = $mailbox | %{[regex]::Match($_.description,"\d{2}\W\d{2}\W\d{4}")}
 $test.value
0
 

Author Closing Comment

by:Radim88
Comment Utility
thx
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
Utilizing an array to gracefully append to a list of EmailAddresses
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now