1

Im stuck with regex command, to find duplicate of partial string.

1st problem: This is what I have in my file

1;0197CE75;BC702
2;01966666;BC702
3;018B9AC5;BC702
42;018B9E21;BC702
6;018B9AC5;BC702
776;018BA0A4;BC702

As you can see I have 2x 018B9AC5, on 3; and 6; I would like to use Notepad++ mark option, in CTRL+H, to quickly detect those 2 duplicates between ; ; in different rows. Is it possible?

2nd problem: This is what I have in my file

1;0197CE75;BC702
2;01966666;BC702
3;018B9AC5;BC702
3;018B9E21;BC702
36;018B9AC9;BC702
776;018BA0A4;BC702

As you can see now I have 2x 3; can I mark that too somehow with another regex command or it is possible to have 1 regex command for both markings?

This regex:

(?=\b\w{8}\b)\w*[A-Za-z0-9]\w*

is marking all in 2nd column, i need only duplicates...

This regex:

^(.*?)$\s+?^(?=.*^\1$)

is marking the same rows, if there are duplicate rows

 3;018B9AC5;BC702
 3;018B9AC5;BC702

I need to mark duplicate of part of row... between ; ;

  • I'm afraid you can't do such job with Notepad++. You have to write a script in your favorite scripting language. – Toto Nov 11 '18 at 11:00
0

Notepad++ is not the best tool for these kind of operations.

I don't thing you can mark duplicates, but I know of a way in which you may extract them.

The article Sorting lines with plugin TextFX says about using the TextFX plugin :

To sort your text:

  • From menu: TextFX | TextFX Tools and select one of the following:
    • clear the check mark for option "+Sort ascending" to sort descending order.
    • enable the check mark for option "+Sort ascending" to sort ascending order.
  • Select the text, either lines of text or columns (see below for column mode select).
  • From menu: TextFX -> TextFX Tools -> {menu_cmd} where you select for {menu_cmd} one of the two commands at the top of the menu bar; that is, either:
    • "Sort lines case sensitive (at column)"
    • "Sort lines case insensitive (at column)"

TextFX Tools will sort only the lines you select. If you do a column mode select (Hold Shift + Alt keys down and select text via mouse), then it will sort all the lines that are at least partly selected, but will sort them according to the selected part.

To be able to sort by column, you will need perhaps to replace the semi-columns by a tab, at least temporarily.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.