Remove first and last three character of a word with powershell -


i have list of users in text file who's names in following format: xn-tsai-01.

how script remove xn- keep -01 output like: tsai

i know how in bash not familiar powershell.

thanks in advance!

here quick way using regex:

'xn-tsai-01' -replace '.*?-(.*)-.*','$1' 

example list:

(get-content list.txt) -replace '.*?-(.*)-.*','$1' 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -