IRI regex quiz!

Hi,

  I made the following regular expression for the IRI token as defined
in RFC 3987 but I think I made a mistake? Who can spot it? (You have to
remove all white-space to make it a legal expression of course).

  [A-Za-z][-+.0-9A-Za-z]*:(?:/(?:(?:%[0-9A-F]{2}|[^\x00-\x20"#%/<>?[-
  ^`{-}\x7F-\x9F\x{D800}-\x{F8FF}\x{FDD0}-\x{FDEF}\x{FFF0}-\x{FFFF}\x
  {1FFFE}\x{1FFFF}\x{2FFFE}\x{2FFFF}\x{3FFFE}\x{3FFFF}\x{4FFFE}\x{4FF
  FF}\x{5FFFE}\x{5FFFF}\x{6FFFE}\x{6FFFF}\x{7FFFE}\x{7FFFF}\x{8FFFE}\
  x{8FFFF}\x{9FFFE}\x{9FFFF}\x{AFFFE}\x{AFFFF}\x{BFFFE}\x{BFFFF}\x{CF
  FFE}\x{CFFFF}\x{DFFFE}-\x{E0FFF}\x{EFFFE}-\x{10FFFF}])+(?:/(?:%[0-9
  A-F]{2}|[^\x00-\x20"#%/<>?[-^`{-}\x7F-\x9F\x{D800}-\x{F8FF}\x{FDD0}
  -\x{FDEF}\x{FFF0}-\x{FFFF}\x{1FFFE}\x{1FFFF}\x{2FFFE}\x{2FFFF}\x{3F
  FFE}\x{3FFFF}\x{4FFFE}\x{4FFFF}\x{5FFFE}\x{5FFFF}\x{6FFFE}\x{6FFFF}
  \x{7FFFE}\x{7FFFF}\x{8FFFE}\x{8FFFF}\x{9FFFE}\x{9FFFF}\x{AFFFE}\x{A
  FFFF}\x{BFFFE}\x{BFFFF}\x{CFFFE}\x{CFFFF}\x{DFFFE}-\x{E0FFF}\x{EFFF
  E}-\x{10FFFF}])*)*)?|(?:%[0-9A-F]{2}|[^\x00-\x20"#%/<>?[-^`{-}\x7F-
  \x9F\x{D800}-\x{F8FF}\x{FDD0}-\x{FDEF}\x{FFF0}-\x{FFFF}\x{1FFFE}\x{
  1FFFF}\x{2FFFE}\x{2FFFF}\x{3FFFE}\x{3FFFF}\x{4FFFE}\x{4FFFF}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x{BFFFE}\x{BFFFF}\x{CFFFE}\x
  {CFFFF}\x{DFFFE}-\x{E0FFF}\x{EFFFE}-\x{10FFFF}])*)?

Thanks,
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Thursday, 12 January 2006 13:29:57 UTC