• Login
Community
  • Login

Use a custom language definition to mark an entire line if it contains an operator

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
custom language
8 Posts 3 Posters 1.3k 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.
  • M
    mvancleave99
    last edited by Aug 3, 2019, 10:33 PM

    I have a situation where I need to mark any line that contains a particular operator (in this case “@”). The operator may not necessarily appear at the start of the line, but I want to highlight the entire line nonetheless.

    For example I would like to be able to mark the whole line below. I can get it to mark from the “@” to the end of the line, but don’t know how to pick up the words before the operator.

    in a@Lush Forest

    Thanks in advance!

    E 1 Reply Last reply Aug 3, 2019, 10:53 PM Reply Quote 0
    • E
      Ekopalypse @mvancleave99
      last edited by Ekopalypse Aug 3, 2019, 10:54 PM Aug 3, 2019, 10:53 PM

      @mvancleave99

      open find dialog, goto mark tab and put the following into find what: (?-s).*@.*
      check regular expression and press mark all.

      1 Reply Last reply Reply Quote 1
      • M
        mvancleave99
        last edited by Aug 3, 2019, 11:02 PM

        Thanks for the quick response!

        That works once, but won’t work for new text entries that meet the criteria. Mark was probably a bad choice. “Custom format” would be more correct.

        I have created a User Defined Language definition, which has worked well for most of my needs. This is the only one that is giving me a bit of a headache.

        E 1 Reply Last reply Aug 3, 2019, 11:08 PM Reply Quote 0
        • E
          Ekopalypse @mvancleave99
          last edited by Aug 3, 2019, 11:08 PM

          @mvancleave99

          actually the title says it, my bad, sorry.
          No, I don’t think you can do this with udl.
          What you can do is using a scripting language in combination with your udl
          like described here .

          1 Reply Last reply Reply Quote 0
          • E
            Ekopalypse
            last edited by Ekopalypse Aug 3, 2019, 11:14 PM Aug 3, 2019, 11:13 PM

            @mvancleave99
            I have to add that this solution, using pythonscript in combination with udl, works only if
            you use a 64 bit npp version < 7.x or a 32bit version of npp.

            A 1 Reply Last reply Aug 3, 2019, 11:16 PM Reply Quote 1
            • A
              Alan Kilborn @Ekopalypse
              last edited by Aug 3, 2019, 11:16 PM

              @Ekopalypse

              Where does the trouble lie with PS and N++ >7.x and 64 bits? To make it work fully, does it require a PS code change, a N++ code change, or both? (If you know)

              E 1 Reply Last reply Aug 3, 2019, 11:19 PM Reply Quote 1
              • E
                Ekopalypse @Alan Kilborn
                last edited by Ekopalypse Aug 3, 2019, 11:20 PM Aug 3, 2019, 11:19 PM

                @Alan-Kilborn

                a PS code change is needed for the callbacks as scintilla >=7.x introduced a different
                notification structure, like int fields, formely 32bit, became int_ptr now 64bit on 64bit OS
                and 32bit on 32bit OS.

                1 Reply Last reply Reply Quote 3
                • M
                  mvancleave99
                  last edited by Aug 3, 2019, 11:24 PM

                  @Ekopalypse

                  No worries! People (especially newbies) never post their actual question. Instead they post what they think their question is, so your original answer was quite reasonable. :-)

                  Yeah. I think I’ll live with what is a minor anomaly for me. The scripting solution will be above my head … ;-)

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