我有一種情況,我需要從檔案中洗掉陣列索引
[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
我有一個檔案,那里有數千個鏈接,但我需要類似的東西
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
如何使用任何檔案編輯器(如 vs code)洗掉此陣列索引
uj5u.com熱心網友回復:
如果陣列的索引可能超過 1 位,您可以使用 Notepad :
- Ctrl H
- 找什么:
^. ?(?=https) - 用。。。來代替:
LEAVE EMPTY - TICK 環繞
- 選擇 正則運算式
- 取消勾選
. matches newline - Replace all
解釋:
^ # beginning of line
. ? # 1 or more any character but newline, not greedy
(?=https) # positive lookahead, make sure we have "https" after
截圖(之前):

截圖(之后):

uj5u.com熱心網友回復:
在 Visual Studio Code 上,您可以使用
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/506614.html
