0

I have a URL from which I need to extract a text. The URL is of the form:

abcd.com/File1/00012121
abcd.com/File12/00012121
abcd.com/File123/00012121

I need to extract File1, File12 and File123 respectively.

2 Answers 2

1

You could try something like this:

('abcd.com/File1/00012121' -split '/')[1]

Or:

'bcd.com/File1/00012121' -split '/' | Select -First 1 -Skip 1
Sign up to request clarification or add additional context in comments.

2 Comments

You can use -Index 1 instead of -First 1 -Skip 1.
Awesome tip PetSerAl! Didn't know this, thank you :)
0

try

$URL -replace '.+\/(\w+)' , '$1'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.