Tapatalk

Highlight within a String

Highlight within a String

6
NewbieNewbie
6

    Mar 28, 2006#1

    I'm looking to do syntax highlighting within a string. Here is what I would like to see:
    2000000001BRRYXYZQGUTZMST1122334 xxy 12 Frank
    2000000002BRRYXYZQARNLDTM1020304 xrq 03 Jane
    2000000003BRRYXYZQROBRTJN0102O30 xdr 02 Sam
    2000000004BRRYXYZQBOBRTJN0102030 wer 11 Ducky

    I'm looking to highlight the seven letters that start before the last set of 7 digits only if they match a pre determined set of stings. So in the above strings I would like to highlight GUTZMST, ARNLDTM, and ROBRTJN but not highlight BOBRTJN as it is incorrect.

    Second feature if possible would be to highlight errors in the coding. The last seven characters are always digits and the 7 before them are always characters. See the O in the third line that should be a zero? Since it is not a digit, I would like it highlighted to spot the error quickly.

    The first 18 rows are always the same except the index number in columns 2-10. BRRYSYZQ is always the same and in the same columns. GUTZMST is the predefined text and the 7 digits after that are a random set of numbers followed by a space then a bunch of other meaningless information for this topic.

    I tried taking HTML tags and adding my predefined text but I don't have a good starting and ending delimiter. Could use BRRYSYZQ but how do I check the next 7 characters only? How can I also check for stray letters in the last 7 digit field?

    Thanks,

    6,685587
    Grand MasterGrand Master
    6,685587

      Mar 28, 2006#2

      Normally what you want cannot be done. But in your special case I think it is possible.

      First make sure your language definition is case-sensitive which is default if keyword Nocase does not exist.

      Because BRRYSYZQ is always the same and the uppercase letter Q is not inside in one of the keywords you should add the uppercase Q to /Delimiters = list.

      But this would not be enough to get the keywords highlighted and see errors in the 7 digits block. To get this also to work, specify the 10 numbers 012345679 also in the list of delimiters. Now every digit is a single word and is highlighted with the color for numbers. Now the wrong uppercase O can be seen easily because it is highlighted with normal text color and not with the color for numbers.

      Example:

      /L20"gutzy" Noquote File Extensions = xxx
      /Delimiters = Q 0123456789
      /C1"Keywords" STYLE_KEYWORD
      ARNLDTM
      GUTZMST
      ROBRTJN
      Best regards from an UC/UE/UES for Windows user from Austria

      6
      NewbieNewbie
      6

        Mar 29, 2006#3

        Q could be part of the text string. Is there a way to have a two or three character delimiter?

          Mar 29, 2006#4

          I set all 10 digits as delimiters and that works great. To handle the Q problem I just included the first 7 characters as part of my valid syntax list. It's a little ugly in the file but works great!! The red numbers and blue for the correctly coded syntax makes any mistake stand out.

          Only odd ball is if the first column that is suppose to be a number has a letter, then the string syntax is marked incorrect as well as the characters in the number field. Just have to remember to fix the number field first then the character field matches.

          Many thanks!