[TxMt] Better JavaScript functions
Andreas Wahlin
andreaswahlin at bredband.net
Sun Sep 18 18:01:18 UTC 2005
On Sep 18, 2005, at 18:07 , Michael Sheets wrote:
>> (var) this.functionName = function(arguments) { ... }
>>
>
> Knowing nothing of javascript... if there are parens around var you
> didn't include them in the regex.
>
> On matching the contents of the parens you can also use a non-
> greedy match:
>
> \\((.*?)\\)
>
> Yours of course will work fine, I just wish I'd figured out non-
> greedy matches faster when I was learning ;)
By parens I take it you mean paranthesis? My bad, they aren't
supposed to be there, I used them to emphasise that you can skip the
var part and thus have either
this.functionName = function(arguments) { ... }
or
var this.functionName = function(arguments) { ... }
On a side note, again ... when do you use non-greedy matches and what
are they good for?
Andreas
More information about the textmate
mailing list