Skip to content

Instantly share code, notes, and snippets.

@auroranockert
Created October 22, 2013 14:15
Show Gist options
  • Save auroranockert/7101505 to your computer and use it in GitHub Desktop.
Save auroranockert/7101505 to your computer and use it in GitHub Desktop.
canon
se
[email protected]
asd ad.se
ads_asd.googol.com
東方.jp
perfect.jp
en.wikipedia.org
www.iana.org
olle.dk
google.se
dickwad.co.uk
as-sd.se
ålandsmål.se
fejsbæk.se
ditt-överdrivna-jävla-åbäke.se
räksmörgås.se
garçon.se
á-la-maison.fr
eïna.se
ə-is-the-magic-sound.se
enŋ.se
ASMYCKET-STORA-BOKSTÄVER.se
þʒǯ.se
99-problems-but-IDN-aint-one.se
àǎâćčđðé.se
èêěëǧǥí.se
ìîǐǩłńñó.se
òôǒõ.se
øřśšţŧúùǔüýźž.se
airbus.aero
goto.asia
lolcat.biz
lol.cat
google.com
dat.coop
my.info
really.int
i.want.jobs
wap-ads.mobi
modern.museum
my.name
that.net
lol.org
i.am.a.pro
telia.tel
go.travel
lolporn.xxx
get.some.edu
uptime.gov
isitbombedyet.mil
a.ac
b.ad
c.ae
d.af
e.ag
f.ai
g.al
h.am
require 'active_support/core_ext/string'
real = 'a-z0-9\-'
se = 'åäöáàǎâåäæćčçđðéèêěëəǧǥíìîǐïǩłńñŋóòôǒõöøřśšţŧúùǔüýźžþʒǯ' # Yiddish names, which are allowed in .se, are not correctly validated yet, sorry.
label = "[#{real}#{se}]+"
check = /\A(#{label}\.)+#{label}\z/
fails = File.read('fails.txt').each_line do |l|
line = l.chomp.mb_chars.downcase
puts "#{line} passed, but should fail" if check === line
end
passes = File.read('pass.txt').each_line do |l|
line = l.chomp.mb_chars.downcase
puts "#{line} failed, but should pass" unless check === line
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment