in reply to Regex for replacement

my $str = "//111.11.112.12/abc/main/myfolder/docs"; my $replace = "something"; $str =~ s#.+(?=/main)#$replace#"; print "str now = $str";
output:
str now = something/main/myfolder/docs

davidj

update:Thanks davido for pointing out the error in my response. I guess I need to read the questions a little more closely. Your solution (in addition to being correct :) ) is much better.
davidj