Page 1 of 1

Syntax Definition File

Posted: Thu Dec 31, 2009 12:39 am
by RJ
I am a new user and am trying to create an syn file for a HIPAA 834 eligibilty file. I would like to highlight key words. Each line is one string usually without spaces. I can't seem to figure out how to only hightlight the key word, it does the entire line.

Here is an example where I would like INS one color, the rest of the starting values (BGN, N1, REF, DTP) another color. The * a different color and the ~ the last color.

BGN*00*28348*20091218*190427****4~
N1*P5*Sending Company*FI*94-1111111~
N1*IN*Receiving Company*FI*73-2222222~
N1*BO*Administrator*FI*55-3333333~
INS*Y*18*030*XN*A***FT~
REF*0F*999999999~
REF*1L*01610H~
REF*17*888888888~
DTP*336*D8*19741209~

Any assistance would be greatly appreciated

RJ

Posted: Thu Dec 31, 2009 2:00 am
by Bob Hansen
The currrent TextPad syntax file only works with "words" or strings delimited by space chars.

Would it be possible for you to use TextPad to insert spaces around the keywords? Then they would be colored. This would be a simple process to do with RegEx if the keywords are always in a fixed position.

From your example it looks like the keywords are always at the beginning, so you could do something like this:
Search for: ^(.{2,3})\*
Replace with: \1_* (using "_" to represent a space char)

This will insert a space after the first 2-3 chars followed by an asterisk. Now the syntax file will accept those keywords at the beginning.

You could make a macro to insert the spaces, do your work, and run another macro to remove that space char that was inserted. Assign hot keys to each of the macros and it will only take you a keystroke to prepare the file and then restore it.

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------

Posted: Thu Dec 31, 2009 3:15 pm
by RJ
Thanks Bob, I'll give it a try.