I am cracking my head open with this:
I want to create passwords based on patterns. In those patterns I want to have repeating parts like a{3} => aaa
, (ab){3} => ababab
or [ab]{3} => aba or aaa or bbb etc.
.
I have “built” a suitable Regex expression:
/(?:([[abcdef]+])|(([[]abcdef]+))|([abcdef])){(d+)}/i
Now I have the problem that the result is either
[match,nil,nil,count]
or
[nil,match,nil,count]
or
[nil,nil,match,count]
So I have to build s.th. like $1+$2+$3
repeated count.times.
Is it possible to get the matching group-part in $1 and my count always in $2?
In regex101 I got it to work with (?|
but Ruby does not understand that.
I hope it is clear what I want!?