How to get a list of matchable characters from a regex class
<p>Given a regex character class/set, how can i get a list of all matchable characters (in python 3). E.g.:</p>

<pre><code>[\dA-C]
</code></pre>

<p>should give</p>

<pre><code>['0','1','2','3','4','5','6','7','8','9','A','B','C']
</code></pre>

<pre><code>import re

x = '123456789ABCDE'
pattern = r'[\dA-C]'
print(re.findall(pattern,x))    
#prints ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C']
</code></pre>

<p>Is this what you are looking for? </p>

<p>If you don't have <code>x</code> and just want to match ascii characters you can use :</p>

<pre><code>import re
import string

x = string.ascii_uppercase + string.digits
pattern = r'[\dA-C]'
print(re.findall(pattern,x))    
</code></pre>

<p>If you want to take inputs for the pattern you can simply just do:</p>

<pre><code> pattern = input() #with either one from above
</code></pre>

python regex python-3.x