anchor.diff:  prepare_matching(undefined) ->
       undefined;
   prepare_matching(Pattern) ->
  -    EPattern = binary:replace(Pattern, <<".">>, <<"\\">>, [global, {insert_replaced, 1}]),
  +    EPattern0 = binary:replace(Pattern, <<".">>, <<"\\">>, [global, {insert_replaced, 1}]),
  +    EPattern = binary:replace(EPattern0, <<"*">>, <<".*">>, [global]),
       case re:run(EPattern, "{[^}]+}", [global]) of
           {match, Match} ->
               Regex = lists:foldr(
  
positive.code:                     <<Prefix:Start/binary, _:Len/binary, Suffix/binary>> = Patt,
                      <<Prefix/binary, "([a-zA-z0-9]*)", Suffix/binary>>
                  end, EPattern, Match),
              {ok, MP} = re:compile(<<"^", Regex/binary>>),
              {MP, [binary_to_existing_atom(binary:part(EPattern, Start+1, Len-2), latin1) || [{Start, Len}] <- Match]};
          nomatch ->
              {Pattern, []}
  
negative.code:     matchtst(#{devaddr => <<"00112233">>}, <<"prefix.{devaddr}">>, <<"prefix.00112233">>),
      matchtst(#{devaddr => <<"00112233">>}, <<"{devaddr}/suffix">>, <<"00112233/suffix">>),
      matchtst(#{devaddr => <<"00112233">>}, <<"prefix:{devaddr}:suffix">>, <<"prefix:00112233:suffix">>),
      matchtst(#{group => <<"test">>, devaddr => <<"00112233">>}, <<"{group}-{devaddr}">>, <<"test-00112233">>),
      ?_assertEqual(#{devaddr => <<"00112233">>},
          match_pattern(<<"00112233/trailing/data">>, prepare_matching(<<"{devaddr}/*">>))),
      ?_assertEqual(#{devaddr => <<"00112233">>},
          match_pattern(<<"/leading/data/00112233">>, prepare_matching(<<"*/{devaddr}">>)))].
  
  % end of file
  