<div dir="ltr">Awesome... it wouldn't let me match against a value but your way with the _/bits works great.  Thanks!</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 12, 2014 at 1:59 AM, Vlad Dumitrescu <span dir="ltr"><<a href="mailto:vladdu55@gmail.com" target="_blank">vladdu55@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi!<br>
<br>
I think that if your parameter is a binary, then whan you match<br>
something that isn't combining to an integer amount of bytes you have<br>
to add a bitstring tail.<br>
<br>
2> <<A:6>> = <<8>>.<br>
** exception error: no match of right hand side value <<"\b">><br>
3> <<A:6,_/binary>> = <<8>>.<br>
** exception error: no match of right hand side value <<"\b">><br>
4> <<A:6,_/bitstring>> = <<8>>.<br>
<<"\b">><br>
<br>
regards,<br>
Vlad<br>
<div><div class="h5"><br>
<br>
On Wed, Feb 12, 2014 at 10:48 AM, Mike Oxford <<a href="mailto:moxford@gmail.com">moxford@gmail.com</a>> wrote:<br>
> decode(Charset, <<A:6,B:6,C:6,D:6, T/binary>>, Acc)<br>
><br>
> Match incoming stuff, 3 bytes at a time and put the remainder in T.  No<br>
> problem.<br>
><br>
> If I get 5 bytes it has issues because it's not on the 3-byte boundary.<br>
> Fine ... except ...<br>
><br>
> I've tried...<br>
><br>
> 1)  Match less params...try <<A,B,C,D, T>> then <<A,B,C,D >>, <<A,B,C>>,<br>
> <<A,B>> and so on.<br>
> 2)  Match against zeros <<A:6, B:6, 0:6, 0:6>><br>
> 3)  Match against various combinations of bit-widths and remainder/tails<br>
><br>
> It seems as if it must match exactly, yet matching against the varying<br>
> levels of parameters doesn't seem to work.<br>
><br>
> I couldn't find anything on Google about this particular matching case.<br>
><br>
> Thanks in advance!<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
</blockquote></div><br></div>