[TxMt] Re: Better URL detection pattern

Allan Odgaard mailinglist at textmate.org
Wed Jul 28 09:25:13 UTC 2010

On 28 Jul 2010, at 10:58, Juande Santander Vela wrote:

> I do not now if regular expressions are involved in the way TextMate 
> detects URLs in text, but I'd gather they do [...]

Indeed they are: http://manual.macromates.com/en/language_grammars

> [...] The only problem I find with it is that the references to LaTeX 
> parts, sections, chapters, etc., built from the LaTeX templates would 
> be matched as well.

I had a look at his earlier pattern(s) and I think my conclusion was 
also, that we would just get underlining for more false positives. What 
we presently use (in the Text grammar) is this rule:

  { name = 'markup.underline.link.text';
    match = '(?x)

It’s fairly simple compared to Gruber’s pattern, but it has worked 
quite well for me.

> Can this be built into TextMate, or where should I change if I wanted 
> it just for personal use?

Do you want this for text files? If so, you should edit the Text grammar 
in the Text bundle. See the above link to language grammars.

Of course if it works well we can put it in the default bundle — we 
prefer receiving pull requests for the bundle in question via GitHub 
(for the text bundle that is http://github.com/textmate/text.tmbundle) 
— don’t know if you are familiar with Git?

More information about the textmate mailing list