Guest User

Untitled

a guest
Jan 20th, 2013
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var pattern_delims_gen = ':\\/\\?#\\[\\]@';
  2. var pattern_delims_sub = '!\\$&\'\\(\\)\\*\\+,;=';
  3. var pattern_reserved = pattern_delims_gen + pattern_delims_sub;
  4. var pattern_unreserved = 'A-Z0-9-\\._~';
  5. var pattern_pctencoded = '%[A-Fa-f]{2}';
  6. var pattern_pchar = '([:@' + pattern_unreserved + pattern_delims_sub + ']|' + pattern_pctencoded + ')';
  7. var pattern_decoctet = '([0-9]|[1-9][0-9]|2[0-4][0-9]|25[0-5])';
  8. var pattern_segment = pattern_pchar + '*';
  9. var pattern_segment_nz = pattern_pchar + '+';
  10. var pattern_segment_nznc = '([@' + pattern_unreserved + pattern_delims_sub + ']|' + pattern_pctencoded + ')+';
  11.  
  12. var part_scheme = '[A-Za-z][A-Za-z0-9\\+\\-\\.]*';
  13.  
  14. var part_userinfo = '([:' + pattern_unreserved + pattern_delims_sub + ']|' + pattern_pctencoded + ')';
  15. var part_host_ipv4 = pattern_decoctet + '\\.' + pattern_decoctet + '\\.' + pattern_decoctet + '\\.' + pattern_decoctet;
  16. var part_host_ipliteral_ipv6 = '';
  17. var part_host_ipliteral_future = 'v[A-Fa-f]+\\.[:' + pattern_unreserved + pattern_delims_sub + ']+';
  18. var part_host_ipliteral = '\\[(' + part_host_ipliteral_ipv6 + '|' + part_host_ipliteral_future + ')\\]';
  19. var part_host_regname = '([' + pattern_unreserved + pattern_delims_sub + ']|' + pattern_pctencoded + ')';
  20. var part_host = '(' + part_host_ipliteral + '|' + part_host_ipv4 + '|' + part_host_regname + ')';
  21. var part_port = '[0-9]*';
  22. var part_authority = '(' + part_userinfo + '@)?' + part_host + '(:' + part_port + ')?';
  23.  
  24. var part_path_abempty = '(\\/' + pattern_segment + ')*';
  25. var part_path_absolute = '\\/' + pattern_segment_nz + part_path_abempty;
  26. var part_path_noscheme = pattern_segment_nznc + part_path_abempty;
  27. var part_path_rootless = pattern_segment_nz + part_path_abempty;
  28. var part_path_empty = '';
  29.  
  30. var part_hier = '(' +
  31.     '\\/\\/' + part_authority + part_path_abempty + '|' +
  32.     part_path_absolute + '|' +
  33.     part_path_rootless + '|' +
  34.     part_path_empty +
  35. ')';
  36.  
  37. var part_query = '(' + pattern_pchar + '|[\\/\\?])*';
  38. var part_fragment = '(' + pattern_pchar + '|[\\/\\?])*';
  39.  
  40. var uriPattern = part_scheme + ':' + part_hier + '\\?(' + part_query + ')?(#' + part_fragment + ')?';
  41. document.write(uriPattern);
  42.  
  43. //[A-Za-z][A-Za-z0-9\+\-\.]*:(\/\/(([:A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2})@)?(\[(|v[A-Fa-f]+\.[:A-Z0-9-\._~!\$&'\(\)\*\+,;=]+)\]|([0-9]|[1-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|2[0-4][0-9]|25[0-5])|([A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2}))(:[0-9]*)?(\/(([:@A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2}))*)*|\/(([:@A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2}))+(\/(([:@A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2}))*)*|(([:@A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2}))+(\/(([:@A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2}))*)*|)\?((([:@A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2})|[\/\?])*)?(#(([:@A-Z0-9-\._~!\$&'\(\)\*\+,;=]|%[A-Fa-f]{2})|[\/\?])*)?
RAW Paste Data