Hi,
> new one:
> /(ftp:\/\/|http:\/\/|https:\/\/|www|[a-zA-Z0-9-]+\.|[a-zA-Z0-9\.-]+@)(([a-zA-Z0-9-][a-zA-Z0-9-]+\.)+[a-zA-Z]+[a-zA-Z0-9-,\.\/\_\?\%\#\&\=\;\~\!\(\)]+)/
>> the old one was also vulnerable to stupid domains like -.-.- - the new
> one is still not perfect, but ...
You could have a separate regexp that matches valid time ranges,
something like:
/\b[0-9]{2}:[0-9]{2}-[0-9]{2}:[0-9]{2}\b/ # perlish \b
and then only match your domain regexp on the condition that the time
range didn't match, something like so:
if ( TIME_RANGE_REGEXP_HERE )
# Whatever it is you normally (don't) do.
else if ( DOMAIN_NAME_REGEXP_HERE )
highlight
This being a kinda obvious solution, I'm wondering if it's already been
shot down? If so, why? Not criticising, just curious as to people's
approaches to these things. I know if I read the increasingly clever
domain regexp I wouldn't notice that it skips numeric domain names /
time ranges, so I'd prefer to see the time range regexp case matched
explicitly.
-Kev
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!