In general, regular expressions are limited to regular languages, which means that since they are equivalent to languages acceptable by DFAs (discrete finite automata), they can't count, as generalized counting requires an infinite number of states to represent the infinite number of possible counted values.
Since discrete != infinte, you can't really count, but you can do some limited types of matching like in your (a (something) b) example.
Discusses a few limitations of DFAs (and Regular Languages / Regular Expressions by extension)
http://www.cs.washington.edu/education/courses/cse599/99sp/admin/Slides/Week2/sld012.htm
A better, but more verbose slide that expands on the limitations by going into DFAs in (still a bit high level) detail
http://www.cs.princeton.edu/courses/archive/spr05/cos126/lectures/18.pdf
By the way, the inside-out expansion is a cool DFA trick to basically side-step the actual need to count by using pattern matching that happens to rebuild the mirror image of the string. It looks like counting, but will fall apart as soon as you do more interesting things, like require matching in order (as opposed to mirrored order matching).