• Login
Community
  • Login

I would like a plugin that lets you write code in JS to Find in File

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
4 Posts 3 Posters 616 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.
  • E
    Eyal282
    last edited by Jan 1, 2023, 9:16 AM

    After concluding Regex is not real, I would like to have a plugin that asks me to write a code that looks like this:

    function _find_in_file(textArray, resultsArray)
    {
    for(let i=0;i < textArray.length;i++)
    {
    let originalText = textArray[i];
    let alteredText = textArray[i];
    
    removeIdentation(alteredText );
    
    if(alteredText.startsWith("PrintToChat(")
    {
    
    // The array is the text that will be matched, obviously it will require also pushing the file the text is in, and the position it's in.
    resultsArray.push(originalText);
    }
    continue;
    }
    }
    
    1 Reply Last reply Reply Quote 0
    • E
      Eyal282
      last edited by Eyal282 Jan 1, 2023, 9:20 AM Jan 1, 2023, 9:20 AM

      I searched for 10 whole minutes, and wrote the code in 2 minutes.

      The objective is after removing any indents or \n \t \0 \x
      is to match for PrintToChat(…
      and to not match for PrintToChatAll(…
      and to not match for RP_PrintToChat

      Basically anti wildcard on *PrintToChat(

      Unfortunately could not find “anti wild card”

      L P 2 Replies Last reply Jan 2, 2023, 1:18 AM Reply Quote 0
      • L
        Lycan Thrope @Eyal282
        last edited by Lycan Thrope Jan 2, 2023, 1:27 AM Jan 2, 2023, 1:18 AM

        @Eyal282 said in I would like a plugin that lets you write code in JS to Find in File:

        The objective is after removing any indents or \n \t \0 \x

        So, to encapsulate, you’re trying to remove \n (newline), \t (tab), I get these, but \0 or \x I don’t understand, unless you’re trying to remove a hex number \0xa0 and/or \0x0d type of thing. For those that might be able to help, you really should elaborate EXACTLY in the style of this forum available in the FAQ’s section here for how to format and phrase, the text or symbols you want removed.

        Good luck.

        1 Reply Last reply Reply Quote 0
        • P
          PeterJones @Eyal282
          last edited by Jan 2, 2023, 2:00 AM

          @Eyal282 said in I would like a plugin that lets you write code in JS to Find in File:

          Basically anti wildcard on *PrintToChat(

          You don’t need “anti-wildcard”. You need “boundary” from the zero-width assertions. \bPrintToChat\b will search for that text, requiring either start-of-line or spaces/tabs or punctuation before, and end-of-line or spaces/tabs or punctuation after

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