in reply to Simple substitution

Negative lookahead assertion to avoid last _.
my $str = 'Goldman_Sachs_2002'; $str =~ s/_(?!\d*$)//g; print $str;

Replies are listed 'Best First'.
Re^2: Simple substitution
by eversuhoshin (Sexton) on Mar 18, 2011 at 15:00 UTC
    Thank you so much :) I am reading perl regular expression but I am still a novice. Thank you again!!!