$b='This_is_Sample_Text'; if ($b=~/^(.+)_[^_]+$/) { print "\n$1"; ## This_is_Sample }
. = Match any character (except newline)
+ = Match 1 or more times
.+_ = Match upto last underscore(_)
[^_]+$ = Notmatch underscore(_) upto end of the string
In reply to Re: What this pattern matches
by gopalr
in thread What this pattern matches
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |