I read the manuals about using multiline regexes in Perl 5, but still cannot figure out why the following ones don't work as intended:

```
#!/usr/bin/perl

use v5.20;

my $s = <<'ENDSTR';
aaa       : AAA
bbb       : BBB
ccc       : CCC
ENDSTR

my $m = 'bbb';

my $a = $s =~ s/.*^$m *: (.*?)$.*/$1/rsm;
my $b = $s =~ s/[.\n]*?^$m *: (.*)$[.\n]*/$1/rm;

print "a: $a\n";
print "b: $b\n";

```

The intended output of the program is 

```
a: BBB
b: BBB

```

But these regexes produce:

```
a: BBB
ccc       : CCC

b: aaa       : AAA
bbb       : BBB
ccc       : CCC  

```

How to correct these regexes in order to get the needed matches?