regex - How to remove the word and digit with underscore in a string -
i use regular expressions remove "2_abc_" in following string:
$a="2_abc_300_300_300_300_1_120";
i have tried:
$a=~ s/^\d_\w*//;
but doesn't work since w
includes numeric, undercore , alphabet.
you can use [a-za-z]
insted of \w
. or [a-z]
if want lower case letters.
also, if want @ least 1 letter use +
instead of *
.
if want 3 letters use [a-z]{3}
.
Comments
Post a Comment