meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

Pleas fix the regex for matching the domain #127

Open dynia opened 10 years ago

dynia commented 10 years ago

IO.isRemote(this.image) fails with the domain that looks like this "centerparcs.local-like.st" your code matches any number of words returning above mentioned domain as "centerparcs.local" (and shouldn't)

Pleas make a fix on regex: FROM: IO.domainRegex = /(?:(?:http|https):\/\/)((?:w+).(?:(?:\w|.)+))/; TO: IO.domainRgex = /(?:(?:http|https):\/\/)((?:[^/]+).(?:(?:\w|.)+))/;

Greetings :)

dafik commented 10 years ago

i confirm this bug.

my correct version of regexp is /(?:(?:http|https):\/\/)((?:[\w-]+).(?:(?:\w|.)+))/;

dafik commented 10 years ago

second better version. /(?:(?:http|https):\/\/)((?:[\w-]+).(?:(?:\w|-|.)+))/