This works for your test data, but it's very narrowly tailored for your test data:
For your expression, enter this: Count(DISTINCTID)
For your dimension: =Pick(Wildmatch(Q1,1,'1 &*','1&*',2,'*&2*','* 2*',3,'* 3','*&3*','*3 *',4,'*&4*',5,6,7,8,9,'*&9',10,11), 1,1,1,2,2,2,3,3,3,3,4,4,5,6,7,8,9,9,10,11)
If your real data have different types of formats, you're going to have to apply some rules to your data, i.e. always use a space between ampersands and numbers or never include a space. Then you can probably develop a pretty simple "Pick(Wildmatch())" formula.