Notepad++ User Defined Language regex

languagenotepadregex

Is there a way to recognize certain text as a keyword Only if it is the first text in the row?

I don't see such an option within the 'User Defined Language' -> 'Keywords Lists' options

Best Answer

I am afraid this is not possible. You can consult UDL2 documentation to learn about User Defined Language capabilities. It is intentionally restricted in order to be easy enough giving a compromise between usability for ordinary users and efficiency.

Solution: The only thing I can advise to you beyond UDL2 is to create your own build of Notepad++. If you get the source, you can see that all built-in language highlighters are implemented procedurally using .lex files. You can create yours and there you have unlimited highlighting possibilities. Then you need to add color definitions to existing XML files, menu item and necessary bindings and you should be done. Hint: built-in Batch language is already highlighting first word on the line so maybe it is a good point to start from.

Workaround: if highlighting of first word on line is sufficient to you, just switch langugage to Batch. :)

Another solution: In these cases, user RProgram always suggests people to switch from Notepad++ to SynWrite editor. Its user-defined languages have much wider capabilities. Maybe this will be the fastest way how you can get to desired result without going too deep.

Related Question