[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#563030: Possible with some JavaScript



Hi,

since my attachment probably prevented the mail reaching the d-www list,
I'll CC this one (see bug #563030 for missed mails and patch).


On Sat, 25 Jun 2011 10:50:15 -0700
Don Armstrong <don@debian.org> wrote:

> > But since I believe nobody actually does that (easier to simply
> > strip the #)
> 
> I actually do, which is why it works.

Please pardon me assuming so then.

> Awesome. However, the regex for this is needlessly complicated [and
> because of that, it probably is incorrect.]
> 
[...]
> This should really just be:
> 
>         var url_test = /^https?://.+\.debian.org/Bugs/\s*\#(\d+)\s*$/;
[...]
> or similar. [Someone who actually writes JS can probably make the
> double testing slightly more elegant.]

Yes, I am not attached to that regex, but don't feel that
comfortable writing one (it would probably break on something ;)

Why I chose that regex, is that it is used by the MooTools project (a
major JavaScript Framework) and is a relatively core part for matching
anything URI-related there. It is also really universal.
It has seen no changes since January 2010 (according to blame), so I
would believe it is well tested.

For verification, it can be found on github[1], Line 42, (sorry about the
URL).


[1] https://github.com/mootools/mootools-more/blob/38af939e4131c5328a576513265b7a816b90c06c/Source/Types/URI.js

-- 
nyov


Reply to: