Solved

Powershell regular expression

Posted on 2011-03-07
2
1,289 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
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…

752 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