sharepoint online - How to Regex remove multiple invalid characters in powershell? -


i new powershell , know if there way remove specific occurrences of invalid characters using powershell?

/ram-_tranva-_bi.pdf - in instance remove "-__" filename.

/us-lrt---atten.pdf - in instance remove "---" filename

i have tried:

-replace [-]+, ""

-replace -[3], ""

-replace "[#%*:<>?/|-_]", ""

doesn't seem work either way...

can please?

your trouble have enclose values single quotes try :

"/ram-_tranva-_bi.pdf"  -replace '[-]+','' 

or :

"/us-lrt---atten.pdf "  -replace '[-]+','' "/us-lrt---atten.pdf "  -replace '[-]3','' 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -