Solved

Powershell regular expression

Posted on 2011-03-07
2
1,282 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
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 Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
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…

713 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