perlre

Why doesn't the .* consume the entire string in this Perl regex?

Why doesn't the first print statement output what I expect: first = This is a test string, sec = This is a test string Since both * and + are greedy, why does the the inner * i.e. inside the "((" in the first match not consuming the entire string? use strict; use warnings; my $string = "This is a test string"; $string =~ /((.*)*)/; ...

How can I rewrite URLs except those of a particular domain?

Hi. Can you please help me to make perl regexp to replace (http://.+) to http://www.my1.com/redir?$1 but do nothing for urls like http://www.my1.com/ or http://my1.com/ For instance I need to replace http://whole.url.site.com/foo.htm to http://www.my1.com/redir?http://whole.url.site.com/foo.htm http://www.google.com to http://www.my1.co...