Replace duplicate lines with RegEx

Home Forums Multi-Edit Lite Support (Lite) Replace duplicate lines with RegEx

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2883
    sandisk
    Participant

    I am using ME Lite 11.04 and I wish to remove duplicate lines from a sorted list of text. I am trying to use Regular Expressions to perform this task. Here is what I am using:

    Search for: ^(.*)(\r\n\1)+$
    Replace with: \1

    I’ve also tried:

    Search for: ^(.*)(\r?\n\1)+$
    Replace with: \1

    Unfortunately neither of these work.

    Any suggestions?

    #9312
    Clay Martin
    Keymaster

    Hi,
    The Unix style and classic regexp do not work well across line breaks. You should try using the Pearl regexp.

    Thanks,
    Clay

    #9314
    sandisk
    Participant

    I’ve tried these with ALL THREE types: Classic, Unix, Perl. These expressions do not work with any of the three:

    Search for: ^(.*)(\r\n\1)+$
    Replace with: \1

    Search for: ^(.*)(\r?\n\1)+$
    Replace with: \1

    #9346
    Clay Martin
    Keymaster

    Hi,
    Each of those styles uses different wild cards, so a regexp that would work for one would not be the same for the others. Pearl has the ability to refer back to items previously found. Unfortunately, I am not well versed in pearl. Maybe someone else on the forum with more experience in pearl can help construct the correct regexp.

    This link might help:
    http://stackoverflow.com/questions/1573 … ce-feature

    Clay

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.