Tapatalk

Highlight line based on leading character?

Highlight line based on leading character?

5
NewbieNewbie
5

    Aug 14, 2008#1

    I have a custom script that I would like to highlight based on the first character per line. Example:

    +Highlight Red
    .No Highlight
    -Highlight blue

    Can glean from the docs how this might be possible in UE 14.10. Suggestions?

    6,685587
    Grand MasterGrand Master
    6,685587

      Aug 14, 2008#2

      Highlighting an entire line based on a character in a specified column is possible only with line comments:

      Line Comment = + Line Comment Valid Columns = [1] Line Comment Alt = - Line Comment Valid Columns Alt = [1]

      The problem is that only 2 such line comments can be specified and both line comments are highlighted with the same color. So this solution does not work for the highlighting you want for your script.

      You can use following to highlight words starting with + or - :

      /C1"Words starting with +"
      ** +
      /C2"Words starting with -"
      ** -


      But that highlights only the words following immediately the + or - and not the entire lines and this highlighting is not bound on the first character of a line.

      The highlighting could be easily solved if the lines starting with + or - always end with the same (special) character like ! # § or a non breaking space (decimal code 160) because then marker characters or line comment + alternate block comment (has a separate color) could be used to highlight the entire lines, although they would also not be bound on the first column (except the line comment). Such appending of a special character at end of the lines starting with + or - could be easily done on file open with a regular expression replace, but those characters must be removed on every file save again with a regular expression replace.

      Tim, yes if UE would support regular expressions for syntax highlighting, this special need would be no problem.
      Best regards from an UC/UE/UES for Windows user from Austria

      5
      NewbieNewbie
      5

        Aug 18, 2008#3

        Thanks, this gets me close enough!
        Mofi wrote:Tim, yes if UE would support regular expressions for syntax highlighting, this special need would be no problem.
        I agree. Regex based highlighting would be a very useful addition.