Hello how can i extract the date 10/3/2015 6:22:51 PM from the below expression using regex.
disable - Olis - 10/3/2015 6:22:51 PM - est 10 -
CN=K,CN=Users,DC=v,DC=com
Thanks
Hello how can i extract the date 10/3/2015 6:22:51 PM from the below expression using regex.
disable - Olis - 10/3/2015 6:22:51 PM - est 10 -
CN=K,CN=Users,DC=v,DC=com
Thanks
'disable - Olis - 10/3/2015 6:22:51 PM - est 10 -' -match '- (\d.*?) -'
EDIT:
You can use the $matches
command to display all results - here is a really simple example:
$str = "disable - Olis - 10/3/2015 6:22:51 PM - est 10 - CN=K,CN=Users,DC=v,DC=com"
# PATTERN:
$str -match "- (\d.*?) -"
True
# Reading data matching the pattern from string:
$matches
Name Value
---- -----
0 10/3/2015 6:22:51 PM
$matches[0]
10/3/2015 6:22:51 PM