Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Own language highlighting with regex expressions?

    Help wanted · · · – – – · · ·
    4
    4
    6044
    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 Menendez
      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 Frank Scott Sumner 2 Replies Last reply Reply Quote 0
      • Claudia Frank
        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 jS
          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 Sumner
            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
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors