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.8k Views 1 Watching
    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.
    • mvancleave99M Offline
      mvancleave99
      last edited by

      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!

      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE Offline
        Ekopalypse @mvancleave99
        last edited by Ekopalypse

        @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
        • mvancleave99M Offline
          mvancleave99
          last edited by

          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.

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • EkopalypseE Offline
            Ekopalypse @mvancleave99
            last edited by

            @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
            • EkopalypseE Offline
              Ekopalypse
              last edited by Ekopalypse

              @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.

              Alan KilbornA 1 Reply Last reply Reply Quote 1
              • Alan KilbornA Offline
                Alan Kilborn @Ekopalypse
                last edited by

                @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)

                EkopalypseE 1 Reply Last reply Reply Quote 1
                • EkopalypseE Offline
                  Ekopalypse @Alan Kilborn
                  last edited by Ekopalypse

                  @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
                  • mvancleave99M Offline
                    mvancleave99
                    last edited by

                    @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

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors