No correct answer to the original question of the OP up to now...
So, here's the correct answer for vanitygen 0.22 (tested under Linux) (the option "-k" at the end is optional and makes it generating more addresses after one has been found):
Generate a key with address length=
34:
$ ./vanitygen -r "^1[a-zA-Z0-9]{33}$" -k
Generate a key with address length=
33:
$ ./vanitygen -r "^1[a-zA-Z0-9]{32}$" -k
Generate a key with address length=
32 (Hint: This may take a little while...):
$ ./vanitygen -r "^1[a-zA-Z0-9]{31}$" -k
Generate a key with address length=
31 (Warning: This may take quite a while...):
$ ./vanitygen -r "^1[a-zA-Z0-9]{30}$" -k
Generate a key with address length=
30 (Warning: This may take VERY long!):
$ ./vanitygen -r "^1[a-zA-Z0-9]{31}$" -k
Generate a key with address length=
29 (Warning: This may take VERY VERY long!):
$ ./vanitygen -r "^1[a-zA-Z0-9]{28}$" -k
Generate a key with address length=
28 (Warning: This may take VERY VERY VERY long!):
$ ./vanitygen -r "^1[a-zA-Z0-9]{27}$" -k
Generate a key with address length=
27 (Warning: This may take VERY VERY VERY VERY long!):
$ ./vanitygen -r "^1[a-zA-Z0-9]{26}$" -k
Explanation:
To get *exactly* a certain amount of characters (32 for example), you need a regular expression that includes the indicators for "start of string" (^) and "end of string" ($).
For example the regular expression
means:
After the (invisible) start character (^) there is a "1", followed by exactly 31 occurrences of any character a-z or A-Z or 0-9, followed by the (invisible) end character ($).
In contrast, the regular expression
(i.e. omitting the trailing "$") means that an arbitrary number of characters may follow after the first 32 characters --> so in this case you will end up with a 34 character address in most cases, instead of the desired address of length 32.
A few examples of addresses of 32 characters length generated with above method:
Pattern: ^1[a-zA-Z0-9]{31}$
Address: 111ewZDvNuUB1vu7xK7KNWwzU35gNJkW
Privkey: 5HrMK2FSRD7dcRJ7unXYLmC6ZA5zSgJP1fdtXdAQ5Xc4tD1U7fk
Pattern: ^1[a-zA-Z0-9]{31}$
Address: 111vB1s4BdUhvoKhdo6waSCqkB8d9tJ1
Privkey: 5J1BgHaSs8o9fPVPTxbRd2jp7ouSAP8eKi5dpcMi1z59RECZs1U
Pattern: ^1[a-zA-Z0-9]{31}$
Address: 111uSRFo91baBW2A8jRqXNJFdhvCFMJK
Privkey: 5Jgv9enDmwpAVkPcZBzZkntBnpSsHutf8amoMv6mPBSDAdvARYj
PS: To generate an address of length 32 characters *or less*, you would do this:
$ ./vanitygen -r "^1[a-zA-Z0-9]{0,31}$" -k
It means: After "start of string" (^), put a "1" (one), followed by "n" occurrences of a character or number, where "n" can be anything between 0 and 31. This is followed by "end of string" ($).