in reply to Replacing special characters from a URL

Hi punitpawar,

You may not need to create a pattern by hand. In Perl, usually a tool has already been created for any common task you need to accomplish. Please see URI::Escape.

I don't know how your URL domain name got spaces in it, but you might be able to use URI::Escape::uri_unescape either before this point in your program, or here, to help you keep/get them out:

perl -MURI::Escape -E ' my $str = "www.abc%20.com"; say $str; $str = URI::Escape::uri_unescape( $str ); say $str; $str =~ s/\s//g; say $str; '
Output:
www.abc%20.com www.abc .com www.abc.com
Hope this helps!


The way forward always starts with a minimal test.