in reply to Re: how to find particular string and store in to variable
in thread how to find particular string and store in to variable

Assuming, as you do, the extraction of a group of digits at the absolute end of a string, the  .*\/ portion of the regex is unnecessary (although it does no harm), as is the subsequent
    my $var = $1 || '';
capture/fixup statement. (Update: But see also the reply of 1nickt below.) An alternative would be:

c:\@Work\Perl\monks>perl -wMstrict -le "for my $s ( 'http://172.20.37.115:8080/se/1.0/pro/subs/198968', 'http://172.20.37.115.8080/se/1.0/pro/123456/', ) { my ($var) = $s =~ m{ (\d*) \z }xms; print qq{'$s' -> '$var'}; } " 'http://172.20.37.115:8080/se/1.0/pro/subs/198968' -> '198968' 'http://172.20.37.115.8080/se/1.0/pro/123456/' -> ''
with the regex expression  m{ \d* \z }xmsg (note the added  /g modifier) also working.


Give a man a fish:  <%-(-(-(-<