I have a Command Like this
Get-DlpDetailReport -DlpCompliancePolicy “Default DLP Monitoring Policy | Exchange Only” -DlpComplianceRule “Official Label Monitoring” -StartDate “07/05/2022 00:00” -EndDate “07/05/2022 23:59” -PageSize 5000 -EventType DLPRuleHits | where {$_.DlpComplianceRule -eq “Official Label Monitoring”} | Select-Object Date, Title, Actor, DlpComplianceRule, Recipients, AttachmentNames | Export-Csv “OfficialLabelMonitoring5.csv”
I want to only extract - OfficialLabelMonitoring5.csv
How Can I do this ?
sandeep13
(Sandeep Pathak)
August 19, 2022, 7:39am
2
@Ishan_Shelke
first split string with | pipe symbol and get last value from string array, after that you have only Export-Csv “OfficialLabelMonitoring5.csv” this then use substring method .
Gokul001
(Gokul Balaji)
August 19, 2022, 7:40am
3
Hi @Ishan_Shelke
System.Text.RegularExpressions.Regex.Match(YourString,"\S+.csv").Tostring
Regards
Gokul
Can you also show how to extract
Data classification - NCR.xlsx
from
D:\Uipath\AIpReports\Confidential Label Monitoring\Data classification - NCR.xlsx
Gokul001
(Gokul Balaji)
August 19, 2022, 8:58am
5
Hi @Ishan_Shelke
Try this out
System.Text.RegularExpressions.Regex.Match(YourString,"\S+.csv|\S+.xlsx|\S+.pdf|\S+.xls").Tostring
Regards
Gokul
I am only getting Output as
NCR.xlsx
I want : Data classification - NCR.xlsx
Gokul001
(Gokul Balaji)
August 19, 2022, 9:06am
7
Hi @Ishan_Shelke
Can you provide us the input
Regards
Gokul
Gokul001
(Gokul Balaji)
August 19, 2022, 9:08am
8
Hi @Ishan_Shelke
Try out this expression
System.Text.RegularExpressions.Regex.Match(YourString,"Data\s\S.+").Tostring
Regards
Gokul
system
(system)
Closed
August 22, 2022, 9:09am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.