Community
    • Login

    Own language highlighting with regex expressions?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 8.6k Views 3 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.
    • Manolo Müller MenendezM Offline
      Manolo Müller Menendez
      last edited by

      Hi

      I want to create a own language highlighting for number coded logs. A log string looks like this:

      8,20161220073941.1,16.662422,63.009957,144,1,11,1,-3599,93

      First a identifier, than a timestamp and then additional information seperated by commas. I would like to do it via Regex but I dont know if that is possible. Anyone with an idea?

      Best Regards

      Claudia FrankC Scott SumnerS 2 Replies Last reply Reply Quote 0
      • Claudia FrankC Offline
        Claudia Frank @Manolo Müller Menendez
        last edited by

        @Manolo-Müller-Menendez

        UDL doesn’t support regex yet which means you either have to write your own lexer as a plugin
        or you use some scripting languages like python script and lua script to do it.
        Next decision would be if the formatting should be updated constantly while file changes or
        if it is only necessary on load as file content will not change. Latter is much easier to implement
        as you only have to deal with bufferactivated callback.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Js jSJ Offline
          Js jS
          last edited by

          @Manolo-Müller-Menendez said:

          8,20161220073941.1,16.662422,63.009957,144,1,11,1,-3599,93

          not regex for highlighting, and you would have to add tags (use regex for this if you wish)

          modify lines as follows

          !_ 8,@_ 20161220073941.1,#_ 16.662422,$_ 63.009957,%_ 144,1,11,1,-3599,93

          user language … operators & delimiters

          delimiter style1: color red
          open: !
          close: ,

          delimiter style2: color blue
          open: @
          close: ,

          delimiter style3: color yellow
          open: #
          close: ,

          and so on

          it is a hack, but it works

          hope this helps

          1 Reply Last reply Reply Quote 0
          • Scott SumnerS Offline
            Scott Sumner @Manolo Müller Menendez
            last edited by

            @Manolo-Müller-Menendez

            I see you’ve posted exactly one time, so maybe the odds are good that you aren’t lurking and just waiting on an answer to your question, but since @Js-jS has refreshed this old thread, and @Claudia-Frank just yesterday posted something that may work to solve it, have a look at:

            https://notepad-plus-plus.org/community/topic/13183/poorman-regex-based-styler-lexer

            1 Reply Last reply Reply Quote 0

            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