简体   繁体   中英

Find and replace using regular expressions in Notepad++

I have to make changes to URL's in a couple of notepad files. I was hoping if this could be done using regular expressions.

The URL's are in the following structure,

/web/20120730114452im_/hxxp://mysite1.com
/web/20120730114453im_/hxxp://mysite2.com
/web/20120730114454im_/hxxp://mysite3.com
/web/20120730114454im_/hxxp://mysite4.com

I have to remove the part before the hxxp so what remains after the search and replace is,

hxxp://mysite1.com
hxxp://mysite2.com
hxxp://mysite3.com
hxxp://mysite4.com

What is the regular expression I need to use to get the desired result ?

Thanks for your help.

USE THIS,

FIND:      [ a-z 0-9 _ / ]+/hxxp
REPLACE:   hxxp

Okay, as per your confirmation, a proper regex that won't match too much would be this:

/web/[0-9]+im_/

Where [0-9]+ will match any amount of numbers.

regex101 demo .

Don't forget to check the 'regular expression' checkbox in the Find/Replace dialog box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM