• Login
Community
  • Login

Replace Help

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 1.1k 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.
  • B
    Bortfive
    last edited by Apr 3, 2018, 2:09 AM

    Hi guys,

    I am trying to replace

    That
    Hint “Any Text Here”
    With
    [“Any text Here”] spawn life_fnc_hint

    The Any text here, is not the text that i want, Its like that

    https://i.imgur.com/ZGJf93q.png

    I have a lot of work to do if anyone found the way to do it :)

    https://i.imgur.com/WOlws9w.png

    Can anybody try to help me?

    Thank you in advance.

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Apr 3, 2018, 9:38 AM Apr 3, 2018, 9:36 AM

      Hello, @bortfive,

      • First, I strongly advice you to backup your 271 files !

      • Then, test my regex search/replacement, below, on one file, only !


      • Copy **one of your files in a new tab ( Ctrl + N )

      • Open the Replace dialog ( Ctrl + H )

      • Type in the regex (?-is)^hint (".+?"); , in the Find what: zone

      • Type in the regex [\1] spawn life_fnc_hint , in the Replace with: zone

      • Tick the Wrap around option

      • Click on the Replace All button

      Et voilà !

      Note that, only, all ranges hint ".......";, beginning the lines, are matched !

      So, given the initial text, below :

      hint "Ahora ves los nombres de los jugadores";   hint "This is a test !";
      
      hint "  Has dejado de ver los nombres de los jugadores   ";
      

      You should obtain :

      ["Ahora ves los nombres de los jugadores"] spawn life_fnc_hint   hint "This is a test !";
      
      ["  Has dejado de ver los nombres de los jugadores   "] spawn life_fnc_hint
      

      Now, if you may have several zones hint ".......";, in a same line, change the search regex to :

      (?-is)hint (".+?");

      And, you’ll get the following text :

      ["Ahora ves los nombres de los jugadores"] spawn life_fnc_hint   ["This is a test !"] spawn life_fnc_hint
      
      ["  Has dejado de ver los nombres de los jugadores   "] spawn life_fnc_hint
      

      Notes :

      • First, the (?-is) modifiers :

        • Force the regex engine to consider any dot as matching one single standard character ( and not the EOL ones )

        • Force the search to be sensitive to case ( => So, a line HINT "...."; or Hint "...."; is not matched ! )

      • The part .+? represents the shorter range of characters between the two boundaries "

      • As this range "....." is surrounded by parentheses, it is stored as group 1

      • In replacement, the \1 syntax stands for the group 1 contents

      Best Regards,

      guy038

      B 1 Reply Last reply Apr 3, 2018, 12:29 PM Reply Quote 0
      • B
        Bortfive @guy038
        last edited by Apr 3, 2018, 12:29 PM

        @guy038 i will try it, u are the best bro <3

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