Solved

Powershell regular expression

Posted on 2011-03-07
2
1,303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 

Accepted Solution

by:
Radim88 earned 0 total points
ID: 35055723
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
ID: 35055878
thx
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Synchronize a new Active Directory domain with an existing Office 365 tenant
A procedure for exporting installed hotfix details of remote computers using powershell
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

617 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