Powershell regex help

Status
Not open for further replies.
5 comments
Code:
https://rapidgator.net/file/(.*)\/(.*)

Replace $2

gkHDMn4.png
 
  • Like
Reactions: Gon
thanks for the reply. i have the notepad++ regex code which i posted in my first post. what i am looking for instead of using notepad++, i want to use powershell for the replace.
 
Powershell would be very similar.

Code:
 "https://rapidgator.net/file/asdcb6af26/test.rar" -replace "https://rapidgator.net/file/(.*)\/(.*)", '$2'

MOp5kfq.png
 
  • Like
Reactions: Gon
If you want to grab filenames from all lines in file & save to a new file, this will do it, this presumes the existing file is empty.
GvoWDwQ.png


Code:
foreach($line in [System.IO.File]::ReadLines("e:\rg.txt")) {$line.split('/')[-1] | Add-Content e:\test.txt}
 
  • Like
Reactions: Gon
Status
Not open for further replies.
Back
Top