Search code examples
regexurlnotepad++

Extract the required part from same type of URLs in notepad+++ by regex


I have a list of URLs from same website. How can I extract a particular part of them using regex in Notepad++?

Here is a part of the URLs:

https://www.example.in/example/MT60B2G8HB-48BA-TR?qs=iLbezkQI%252BsgqYFd1yfooJw%3D%3D
https://www.example.in/example/AT25L128A-MHE-T?qs=IS%252B4QmGtzzoXQyQfwYv36A%3D%3D

Output should be MT60B2G8HB-48BA-TR & AT25L128A-MHE-T from all the similar type of URLs.


Solution

  • A short alternative as usual

    Find:^.*/(.*?)\?.*

    Replace with:$1