[TextMate] RegExp question

Allan Odgaard allan at macromates.com
Sat Oct 16 13:39:08 UTC 2004


On 16. Oct 2004, at 15:25, José Campos wrote:

>> Or if it's for styling, use the ability to style captures :)
>
>     Perhaps i've missed a step, but what do you mean by "style
> captures"? Found nothing in the Help file, nor in the Wiki. (only 
> notice
> the smiley :)

It's in the last few paragraphs. If for example we want to underline a 
dot in a string, we could do (for readability, I'm leaving out quotes, 
escapes, and semicolons):

    match = »"[^"]*(\.)[^"]*"«
    fontStyle[1] = »( underline )«

By appending [1] to fontStyle, we affect the style only for the 1th 
capture of the match.  The other way to do it would have been (assuming 
we want the string to be on a single line here):

    begin = »"(?=.*")«
    end = »"«
    patterns = (
       { match = »\.«
         fontStyle = »( underline )«
       }
    )



Kind regards Allan




More information about the textmate mailing list