-1

I would like to delete a row with repeated numbers.

So, for example, if I have a string like this:

*imie Małgorzata numer 000333444 lokalizacja Łuków
imie Ola numer 000333444 lokalizacja Łuków
imie Gosia numer 555444333 lokalizacja Łuków
imie mariusz numer 598418415 lokalizacja Łuków* 

The desired result will be:

*imie Małgorzata numer 000333444 lokalizacja Łuków
imie Gosia numer 555444333 lokalizacja Łuków
imie mariusz numer 598418415 lokalizacja Łuków*

1 Answers1

0
  • Ctrl+H
  • Find what: (^.*?(\b\d+\b).*\R)^.*?\2.*\R?
  • Replace with: $1
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

(       # start group 1
  ^       # beginning of line
    .*?     # 0 or more any character but newline, not greedy
    (       # start group 2
        \b      # word boundary
        \d+     # 1 or more digits
        \b      # word boundary
    )       # end group 2
    .*      # 0 or more any character but newline
    \R      # any kind of linebreak
)       # end goup 1
  ^       # beginning of line
    .*?     # 0 or more any character but newline, not greedy
    \2      # backreference to group 2 (i.e. the digits)
    .*      # 0 or more any character but newline
    \R      # any kind of linebreak, optional

Replacement:

$1          # content of group 1 (i.e. the first line)

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

Toto
  • 89,455
  • 62
  • 89
  • 125