[英]Extract text from a string using Powershell
I have a URL from which I need to extract a text. 我有一个URL,需要从中提取文本。 The URL is of the form: URL的格式为:
abcd.com/File1/00012121
abcd.com/File12/00012121
abcd.com/File123/00012121
I need to extract File1, File12 and File123 respectively. 我需要分别提取File1,File12和File123。
You could try something like this: 您可以尝试这样的事情:
('abcd.com/File1/00012121' -split '/')[1]
Or: 要么:
'bcd.com/File1/00012121' -split '/' | Select -First 1 -Skip 1
尝试
$URL -replace '.+\/(\w+)' , '$1'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.