$str='This is Sample Pre Match Textwww.hotmail.comThis is Sample Post Match Text'; ($pre,$post)=$str =~ m#(.{1,15}).*(.{1,15})#gsi; print "\n$pre"; print "\n$post"