Convert a "mixed-base" string to ASCII Given an input of a string with bytes that may be in either binary, octal, or
hex, output the string's ASCII equivalent.

Input will be provided in the following format, for example:

501200100001147


which represents

0x50 0o120 0b01000011 0x47


which is equivalent (in ASCII) to

PPCG


Binary, octal, and hex will always be provided with 8, 3, and 2 digits
respectively.

For the purposes of this challenge, only printable ASCII must be supported.
This is the range 32..126 inclusive. Therefore, it is impossible for there to
be ambiguity. Note that


A string represents binary if and only if it starts with a 0 and its second
character is either a 0 or a 1. All printable ASCII characters have their
high bit off in binary (i.e. start with a 0), and none of them start with
00 or 01 in either hex or octal.
With binary out of the way, note that all printable ASCII characters start
with 2-7 in hex and 0-1 in octal. Therefore, it is possible to
unambiguously distinguish between hex and octal as well.


You may assume that hex input is provided as either lowercase or uppercase,
whichever is more convenient.

Regex makes the parsing portion of the challenge semi-trivial. I don't want to ban the use of regex outright, but if you have a non-regex solution longer than its regex-using counterpart, feel free to post it along with the "real" answer anyway, since I'd be interested to see it as well. :)

Since this is code-golf, the shortest code in bytes will win.

Test cases:

In                   Out
-----------------------------------
501200100001147    | PPCG
5C01101111100      | \o@
313206306400110101 | 12345
2A200530402C       | * + ,
0011111100111111   | ??
&lt;empty string&gt;     | &lt;empty string&gt;
Lex + C, 156 124 bytes
%{
p(b){putchar(strtol(yytext,0,b));}
%}
%option noyywrap
%%
0[01]{7} {p(2);}
[01].. {p(8);}
.. {p(16);}
%%
main(){yylex();}

Compile with:
lex mixed_base.l
cc -o mixed_base lex.yy.c