[TxMt] TM doesn't have trouble with RE, but I have.
marios
tmtxpstuff at consking.com
Fri Feb 22 04:42:08 UTC 2008
Sven Axelsson wrote:
> On 20/02/2008, marios <tmtxpstuff at consking.com> wrote:
>> So this is the task:
>>
>> Match every beginning of a line, including the first line of the
>> document, and put that in Capture register one, then match every line
>> until the end of the Line, end put that in Capture Register 2, then
>> replace every instance, with some extra Markup (The spantags here ) plus
>> Capture Register 2.
>>
>> This works from within TextMate, but not in Javascript.
>
> OK, so this really hasn't anything to do with TextMate. Perhaps
> Javascript won't let you match newline characters? Try this regular
> expression instead, it may work better:
>
> ^(.*)$
>
That finally didn't work, but I've good news:
This finally works:
pattern: /^(\n)|(\n)/,
replacement: "$2<span class=\"$0\"></span>"
What is interesting to not here, is that this, if I'm not mistaken is
the only way to achieve this. ( Took me about 2 hours to figure this out )
The first part of the RE will take care of the one line that gets lost
by the second part. Sounds weird.
Here is what I have now:
http://www.consking.com/screenshots/Texari_light.png
( Also a little tricky was to get the alignment of the line-numbers right )
I call it TeXarI Light. ( A lite version of Texari )
( Looks almost like TextMate, doesn't it ? )
regrds, marios
More information about the textmate
mailing list