Own language highlighting with regex expressions?
-
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
-
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 -
@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
-
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