How to highlight each char differently within a pattern?


#1

I want to highlight FASTA files. The format is:

For lines begin with '>', highlight as HeaderLine. It is the start of a record.
For other lines, 
    if /[ATCG]/i , highlight the 4 char into 4 different colors. Set HeaderLine to pink.
    if /[ACDEFGHIKLMNPQRSTVWXY]/i , highlight as 5 group into 5 different colors. Set HeaderLine to orange.
    if /[*-?]/ , NOP.
    if /[\r\n\s]/ , NOP
    if other printable char exists, set HeaderLine to red.

I only managed to highlight [ATCGatcg] to 4 colors throughout the whole file with 4 separated patterns. And I donot know how to choose numbers for ‘captures’ in my situation.

BTW: In fact I am writing for TextMate, the ‘foreground’ is fixed in ‘FASTA.tmbundle/Preferences/*.tmPreferences’. I think atom should have similar function.