Notepad++ Search And Replace Multiple Text Lines

萝らか妹 提交于 2019-12-10 11:53:36

问题


Notepad++ Search And Replace Multiple Text Lines

Example:

http://stackoverflow.com/123/xxxr423f3
http://stackoverflow.com/124/frwefr/4324324
http://stackoverflow.com/125/fwerf655446/432/4343
http://stackoverflow.com/140/fdsfdswfds

I only need http://stackoverflow.com/and numbers/

like

http://stackoverflow.com/123/
http://stackoverflow.com/124/
http://stackoverflow.com/125/
http://stackoverflow.com/140/

Thanks :)


回答1:


Please try this if it works:

Find: https://stackoverflow.com/((\d+)/).+

Replace: https://stackoverflow.com/\1




回答2:


You can use the Regular Expression search mode and search with a regular expression; something like this:

(http:\/\/stackoverflow\.com\/\d+\/).*?$

Replace with \1. Which means it will keep whatever is in the parentheses. .*?$ means to find any number of characters afterwards (until the end of the line), and remove them. Maybe this isn't exactly what you intend, but this should point you in the right direction.



来源:https://stackoverflow.com/questions/19305302/notepad-search-and-replace-multiple-text-lines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!