I have a list of directories with files like this:
testing_module/forms/node.js
terraform_packer/globals.js
protection_list/forms/security.js
I want to get with powershell only the folder before the slash:
testing_module
terraform_packer
protection_list
I use -replace with this regex expression to test it:
'testing_module/forms/node.js' -replace '/([^/]+/[^/]+)$'
But it returns the full line.
What should I use?
C:/myfolder/?, ''at the end.'testing_module/forms/node.js' -replace '/([^/]+/[^/]+)$', ''