From Wikibooks, open books for an open world
< CACS‎ | Glossary
Jump to navigation Jump to search

Uniform Resource Identifier (URI) (Internet) The URI is a phase that identifies any object on the internet by specifying the protocol, web address, file location, and name of the object. The URI may also contain data for delivery to the target server, such as a user id or query. A URL is one form of a URI. When accessing the Web, The URI is usually displayed in a special field in the toolbar of a browser. URI originally stood for a Universal Resource Identifier, and details are available from the Internet Engineering Task Force in RFC1630 at IETF Web site.

The following regex may be used to validate strings for the RFC2396 specification:

/^(https?|ftp):\/\/(?#                                      protocol
)(([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+(?#         username
)(:([a-z0-9$_\.\+!\*\'\(\),;\?&=-]|%[0-9a-f]{2})+)?(?#      password
)@)?(?#                                                     auth requires @
)((([a-z0-9][a-z0-9-]*[a-z0-9]\.)*(?#                       domain segments AND
)[a-z]{2}[a-z0-9-]*[a-z0-9](?#                              top level domain OR
    )(\d|[1-9]\d|1\d{2}|2[0-4][0-9]|25[0-5])(?#             IP address
))(:\d+)?(?#                                                port
))(((\/+([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)*(?# path
)(\?([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)(?#      query string
)?)?)?(?#                                                   path and query string optional
)(#([a-z0-9$_\.\+!\*\'\(\),;:@&=-]|%[0-9a-f]{2})*)?(?#      fragment