Is there an easy way to highlight numbers in a different color? I have a file of ICD-9 codes (International Classification of Diseases): lots of text, most of the lines beginning with a 3-5 digit number (the ICD-9 code). The numbers range 001-999, with up to 2 decimal places. A minority of the numbers start with a "V". Can I do this without having to manually type in all the numbers I want in color. Obviously that's impractical, since there are aobut 100,000 of them.
Thanks.
syntax highlighting for numbers?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Create a new document class, for files with the appropriate extension, and use the following syntax definition file:
Choose the same colors for Keywords 1 and Numbers, in your new document class.
Keith MacDonald
Helios Software Solutions
Code: Select all
; numbers.syn
; Syntax definition file for numbers, with optional V prefix
C=1
[Syntax]
KeyWordLength = 1
IgnoreCase = No
[Keywords 1]
V
Keith MacDonald
Helios Software Solutions
Sounds easy enough, but when I try this, I get an error message: something to the effect of "invalid data in line 4 . . . of numbers.syn" The problematic line seems to be C=1. I don't understand that, since the HELP says specifically that C=1, or a variant, should be the first line of a syntax definition file.
Also, where in the numbers.syn file is the instruction to color the numbers?
Thanks.
Also, where in the numbers.syn file is the instruction to color the numbers?
Thanks.
syntax definition file for numbers not working
Well, just keep in mind that I know just enough about computers to be dangerous . . .
I copied the suggested code, and then pasted it into a new TextPad file. When I went to save it, I left all the defaults in the dialogue box alone, and saved it as numbers.syn. So I guess that would be ANSI encoding, and PC format. It ended up saved as numbers.syn.txt. I put that file in C:\Windows\ApplicationData\TextPad, and I renamed it to numbers.syn (via Windows Explorer.)
I then got the error message I posted previously.
Now I'm at home, and tried the whole thing again. This time, using the menus in TextPad, I associated .syn files with TextPad (I don't know if that's necessary or not, but it was the only way I cou8ld think of that would allow me to save it as a .syn file, rather than as a .syn.txt file and then have to rename it.) I also saved it as PC format and DOS encoding. Now I don't get the error message, but I also don't get colors. (I found what you are talking about regarding colors for numbers--thanks.) But still no highlighting.
I copied the suggested code, and then pasted it into a new TextPad file. When I went to save it, I left all the defaults in the dialogue box alone, and saved it as numbers.syn. So I guess that would be ANSI encoding, and PC format. It ended up saved as numbers.syn.txt. I put that file in C:\Windows\ApplicationData\TextPad, and I renamed it to numbers.syn (via Windows Explorer.)
I then got the error message I posted previously.
Now I'm at home, and tried the whole thing again. This time, using the menus in TextPad, I associated .syn files with TextPad (I don't know if that's necessary or not, but it was the only way I cou8ld think of that would allow me to save it as a .syn file, rather than as a .syn.txt file and then have to rename it.) I also saved it as PC format and DOS encoding. Now I don't get the error message, but I also don't get colors. (I found what you are talking about regarding colors for numbers--thanks.) But still no highlighting.
Whoa, now we're getting somewhere
Well, another silly mistake on my part was associating .icd files (that's what I am calling my files full of ICD-9 codes) with TextPad, and with the particular syntax highlighting, rather than *.icd. Fixed that.
Then I set my *.syn files to have DOS encoding by default.
Then I started from scratch, and rather than copying and pasting the suggested code from this forum, I typed it into a new file, fresh, and saved it as numbers.syn.
That seems to have done the trick. I've got color!
Thanks for all your help. Great software, and great user-community support.
Then I set my *.syn files to have DOS encoding by default.
Then I started from scratch, and rather than copying and pasting the suggested code from this forum, I typed it into a new file, fresh, and saved it as numbers.syn.
That seems to have done the trick. I've got color!
Thanks for all your help. Great software, and great user-community support.