I am still finding my way with Regex, but i have hit a bit of a brick wall and need some help pushing through.
I have a PST uploader for office 365 and when a user uploads a pst file it is saved on the server as firstname.lastname@example.org_1.pst. Now through powershell i am attempting to remove the _1.pst (keep in mind the domain name might change and the number can increment up as more uploads from the same user are received).
So I have the following:
$Displayname = "email@example.com_1.pst"
$DisplayName -replace "(_[0-9]).pst$"
When i use the following, the _ and number are removed, but not the .pst isnt.
I think i am close, just missing something simple...