Help save net neutrality! Learn more.
Close

higlighting lines that contain identical strings?

jist me
2012-12-14
2013-01-02
  • jist me

    jist me - 2012-12-14

    Hithere.

    I'm not much of a programmer, and trying to figure out if this can be done with notepad++:

    Suppose the following 5 lines exist in a txt or xml file:

    this line contains #1234abcd#
    random line #123xxx#
    this line also contains #1234abcd#
    this line contains #aa11#
    this line contains #1234AbCd#
    this line contains #aa11#

    What I would like is to have all lines containing identical #*# strings being highlighted.
    So in this example lines 1 and 3, and 4 and 6 would be highlighted.

    A secondary, but far less important wish is that also line 5 gets another type (color?) of highlighting, since it matches lines 1 and 3, but only differs in use of capitals.

    Is this achievable in notepad++?
    I guess it might be with use of some regex?

    Tia!

     
  • cchris

    cchris - 2012-12-29

    You could use TextFX for this as follows:
    1. add line numbers
    + using the align with (Clipboard) character, align all first #'s together
    + now sort text on the fixed columns where the # strings now are
    + now do whatever you ike with the adjacent lines with identical # strings
    + sort by line number to restore previous line orering, remove line numbers and otherwise clean up.

    Not exactly a one clicker, butotherwise you'd need some scripting, as well as answwering a few questions like: when several pairs of lines qualify, are all the pairs highlighted the same? and more.

    CChris

     
    Last edit: cchris 2012-12-29
    • jist me

      jist me - 2013-01-02

      Thnx CChris,

      Great minds think alike ;-) I did exactly that by using Excel.
      I believe scripting and such is above my capabilities, so I'll leave it at this.