I have one situation there I need to remove the array index from file
[0] => https://demo.com/alabama/18-wheeler-towing
[1] => https://demo.com/alabama
[2] => https://demo.com/alabama/winston-county/18-wheeler-towing
[3] => https://demo.com/alabama/winston-county
[4] => https://demo.com/service/18-wheeler-towing-addison-al
[5] => https://demo.com/alabama/winston-county/addison
I have a file there there thousands of link but I need something like
https://demo.com/alabama/18-wheeler-towing
https://demo.com/alabama
https://demo.com/alabama/winston-county/18-wheeler-towing
https://demo.com/alabama/winston-county
https://demo.com/service/18-wheeler-towing-addison-al
https://demo.com/alabama/winston-county/addison
How can I remove this array index using any file editor like vs code
CodePudding user response:
If the index of array may have more than 1 digit, you can do with Notepad :
- Ctrl H
- Find what:
^. ?(?=https)
- Replace with:
LEAVE EMPTY
- TICK Wrap around
- SELECT Regular expression
- UNTICK
. matches newline
- Replace all
Explanation:
^ # beginning of line
. ? # 1 or more any character but newline, not greedy
(?=https) # positive lookahead, make sure we have "https" after
Screenshot (before):
Screenshot (after):
CodePudding user response: