Hi, @larlei, @terry-R and All,
However, @larlei, given the same INPUT text :
01 01 <name>NAME-1</name>
02 <name>NAME 1</name>
03 10 <name>NAME-2</name>
04 <name>NAME 2</name>
05 19 <name>NAME-3</name>
06 <name>NAME 3</name>
Then, the modified search regex of @terry-r, below, with an question mark, after the group 2 ([^<]+) :
SEARCH (?-s)^\d+\h(\d+\h)([^<]+)?.+\R[^<]+(.+\R)
REPLACE \1\2\3
Does match and, after replacement, you get the expected OUTPUT text :
01 <name>NAME 1</name>
10 <name>NAME 2</name>
19 <name>NAME 3</name>
Let’s go back to the wrong syntax of the regex S/R, without the question mark. Why this regex does not find any match ? Well …
From beginning of line, it searches for some digits, followed with one horizontal space character, and this twice ( the part ^\d+\h(\d+\h) )
At this point, it tries to find some characters, all different from an opening tag delimiter <. But this case is impossible as an opening tag delimiter < follows, right before name>. So the overall search regex fails !
Now, adding the exclamation mark, after the group 2, means that all the group contents are not mandatory. Thus, it can be ignored and the following part .+\R does match the remaining of the first line, including its like-break ( \R ) !
And, indeed, I verified that, against our INPUT text, the optional group 2 ([^<]+)? is always EMPTY !
In other words, you can simplify your regex S/R to this syntax :
SEARCH (?-s)^\d+\h(\d+\h).+\R\d+\h(.+\R)
REPLACE \1\2
So, from the INPUT below :
01 01 <name>NAME-1</name>
02 <name>NAME 1</name>
03 10 <name>NAME-2</name>
04 <name>NAME 2</name>
05 19 <name>NAME-3</name>
06 <name>NAME 3</name>
With this new S/R , you would get the same OUTPUT as above, i.e :
01 <name>NAME 1</name>
10 <name>NAME 2</name>
19 <name>NAME 3</name>
BR
guy038