Description
Few items in the urlFilter can be enhanced, I made lot of tests bu test it against a 'full' set, there are so many possibilities and regex can be so...
Here are the Find-Replace by, must apply them in the following order.
(https|http|ftp) by (https?|ftp)
\u00A0 by a space = char 32
As \w covers a-zA-Z0-9_
we can use it, uppercase does not matter
[a-z]|\d|-|.|_|| by \w|-|.||
based on ascii values,
21! 24$ 3B; 3D=
but from $ to , it is a continuous sequence in ascii from 26 to 2C
[!$&'()*+,;=] by [!$;=[&-,]]
the IP numeric string can be replaced by
((AAA(.AAA){3})
where AAA is
(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])
That's all.
If it is correct we had 1200 characters and now 966, between / and ;
Big deal :-o
For info on:
[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]
See http://en.wikipedia.org/wiki/Punycode
That would be a huge gain, if it can be replaced by a 'pattern', don't now if the \1 or $1 backward is working in Javascript in a search (not within a replace)
e.g. blaxyzblablaxyzmnonxyzbalbla
becomes
bla(xyz)blabla\1mnon\1balbla
The first () stores it and then use it afterwards.
But I think JavaScript does not support that kind of backward.
This one is shorter to find IP but need to be tested... it depends of the items around it.
([01]?\d?\d|2[0-4]\d|25[0-5]).
but the AAA solution above is enough.
Thank you.
For formUtils.addValidator, this can be replaced, \w = a-zA-Z0-9_
!(/[^a-zA-Z0-9_\+\.-]/.test(emailParts[0]));
by
!(/[^\w\+\.\-]/.test(emailParts[0]));
And below, two lines have
[0-9.........
by
[\d........
And, minus is move at the beginning to avoid the -
if (domain.replace(/[0-9a-z.-]/g, '')
by
if (domain.replace(/[-\da-z.]/g, '')
End...