Community
    • Login

    Replacing Duped Words across a block block of text, respecting {}

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    23 Posts 2 Posters 7.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Marc LalondeM
      Marc Lalonde
      last edited by

      Since i finished my files, I just took the main original version and first ran it though the validator, 1876 errors, after running the script over it and validator. It got every single one. Only one Minor minor issue that doesn’t really have to be fixed, is it strips the last two closing } brackets at the very end of the file, that takes all of 5 seconds to re-add, i consider this a completed script. I very much appreciate the help for the last 24 hours, it probably saved me double if not more.

      1 Reply Last reply Reply Quote 0
      • Marc LalondeM
        Marc Lalonde
        last edited by Marc Lalonde

        @guy038 For some reason this script has stopped working for me… its now just wiping the entire file.

        Find what : (?si)(?:^|\h+)(“?)['.,]?(\w[\w '.-]\w)['.,]?\1(?=(?:\h+|\R)(?:[^{}](?:\h+|\R))?(”?)[‘.,]?\2[’.,]?\3(?:\h|\R))
        replacing with nothing

        wrap around
        regular expression

        and its blanking the file… (replace all: 1 occurrence was replaced)


        nvm ?..? seems a extra space worked into the code…

        1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by

          Hi, Marc and All,

          IMHO, I supposed that your current file contains too much data ! I, very often, verified that complicated regexes totally fail when applied to huge amounts of text with the result that, only, one wrong match of all the file contents, occurs :-((

          May be, try to slice your file in smaller parts ! It could help ?!

          Generally, this problem often occurs when using recursion feature in regexes. But, it’s quite difficult to fully understand the limitations of the Boost regex engine, used in N++ !

          Cheers,

          guy038

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors