my $string = "abe[123955785ada]sdjdjajd"; if ( $string =~ /\[(.*?)\]/ ) { my $inside = $1; print $inside, "\n"; }