Regex to match all permutations of {1,2,3,4} without repetition
问题 I am implementing the following problem in ruby. Here's the pattern that I want : 1234, 1324, 1432, 1423, 2341 and so on i.e. the digits in the four digit number should be between [1-4] and should also be non-repetitive. to make you understand in a simple manner I take a two digit pattern and the solution should be : 12, 21 i.e. the digits should be either 1 or 2 and should be non-repetitive. To make sure that they are non-repetitive I want to use $1 for the condition for my second digit but