Name
uri_escape
Synopsis
uri_escape uri
, [regexp
]
Description
Given a URI as the first parameter, returns the equivalent URI with certain characters
replaced with % followed by two hexadecimal digits. The first parameter can be a
text string, like “http://www.oreilly.com”, or an object of type URI::URL. When
invoked without a second parameter, uri_escape
escapes characters specified
by RFC 1738. Otherwise, you can pass in a regular expression (in the context
of [ ]
) of characters to escape as the second parameter. For example:
$escaped_uri = uri_escape($uri, 'aeiou')
This code escapes all lowercase vowels in $uri
and returns the escaped version.
Get Perl in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.