I am trying to generate a wordlist. I am using crunch but I am stuck at defining the pattern I want the words to be generated. For example, I want to define a rule such as this:

Password: Ameri948 ca#

Words: [A|a]meri[\d\d\d][space|no space][C|c]a[space|*|#]

Which means, I know the structure of the password and the exact length (here the space or no space plays a role), but not the exact combinations, e.g. the first character is for sure an A but I don't know whether it is a capital A or a lowercase one. And another problem is spaces, to get the password to a certain length, which I know, I tried some sort of padding with spaces in between words.

Can a pattern like this be defined in crunch? Or would you suggest just coding it?

  • I edited your pattern to be a little more regex in feel to be a little more readable
    – schroeder
    Commented Aug 5, 2020 at 18:57
  • Your pattern is too complex for most generators. This is the type of thing to code.
    – schroeder
    Commented Aug 5, 2020 at 18:58

2 Answers 2


You could use a tool like Generex to generate strings out of a regular expression. I think your case would be:


I limited the latter space to max 4 so the regex would be able to terminate. There are some online tools available that do this too.


You can use the sets from crunch. However, there are only 4:

@ , % ^

Depending on the number of spaces, you can write them down directly. For

[A|a]meri[\d\d\d][space|no space][C|c]a[space|*|#]

this could be:

crunch 12 12 aA cC + \ *# -t '@meri%%% ,a^' -o list && crunch 11 11 aA cC + \ *# -t '@meri%%%,a^' >> list

Here I used the 3rd default set (defined with +) what are numbers.

Or you could put a bash script around it, e.g. using https://stackoverflow.com/questions/43076395/how-to-add-x-number-of-leading-spaces-in- a-string-using-bash if you want to loop over some spaces:

for space_amount in {1..3}; do spaces=$(printf "%*s" $space_amount);crunch $(expr 11 + $space_amount) $(expr 11 + $space_amount) aA cC + \ *# -t "@meri%%%$spaces,a^" >> list; done

If you need more sets I would use Generex as recommended from ysf or start expanding it programmatically.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .