Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- should = require 'should'
- reg = /^(?!.{64})[a-z0-9]+(\-[a-z0-9]+)*\.cz$/i
- describe 'domains', ->
- # valid
- it 'seznam.cz', ->
- reg.test('seznam.cz').should.be.true
- it 'nic.cz', ->
- reg.test('nic.cz').should.be.true
- it 'foo-bar.cz', ->
- reg.test('foo-bar.cz').should.be.true
- it 'foo-bar-baz.cz', ->
- reg.test('foo-bar-baz.cz').should.be.true
- it 'i.cz', ->
- reg.test('i.cz').should.be.true
- it '123456789012345678901234567890123456789012345678901234567890.cz', ->
- reg.test('123456789012345678901234567890123456789012345678901234567890.cz').should.be.true
- # invalid
- it 'foo-bar-.cz', ->
- reg.test('foo-bar-.cz').should.be.false
- it '-foo-bar.cz', ->
- reg.test('-foo-bar.cz').should.be.false
- it 'foo--bar.cz', ->
- reg.test('foo--bar.cz').should.be.false
- it 'foo.com', ->
- reg.test('foo.com').should.be.false
- it '-.cz', ->
- reg.test('-.cz').should.be.false
- it '.cz', ->
- reg.test('.cz').should.be.false
- it '123456789012345678901234567890123456789012345678901234567890x.cz', ->
- reg.test('123456789012345678901234567890123456789012345678901234567890x.cz').should.be.false
Add Comment
Please, Sign In to add comment