A regular expression replacing directory structure to increase directory


The following operations need to be solved:
There are multiple shtml files with connection addresses
Now I want to add the directory name Inc to the connection address of these. Shtml files, that is, to

Solution: in general, EDITPLUS and other regular expression support software is OK
Find target:

Copy codeThe code is as follows:

Replace with:

Copy codeThe code is as follows:

Remember to select “regular expression” on the “find mode” below
By the way, what does the above regular mean,
^Match the beginning of each line
$matches the end of each line
(. + /) matching starts from the beginning of the current line to the last / bracket. Here, it means to capture this group, and then it can be replaced in the front with the content that the regular matches by using the ⁃ 1
(. +) matches the character to the right of the last / in the current line to the end of the line (second capture group)
The whole regular above means to find the last / as the first group from the first character of the current line, and the rest as the second group
Replace with: 1inc / \ 2
The first group matches the content of the second group. Inc / is the character you want in the middle
So together, you can achieve what you want
https://www.jb51.net/12/234/ The character that is matched for group one (\ 1)
678. Html is the character matched by group two (\ 2)
And then combined with the content of the replacement, the replacement result is