I have a string that will be used as a config value.. It is like 1|1|1 or 1|1|2 or 2|1|2 and so on. There are eight different combinations. Integers are either 1 or 2..
The problem is that I have to use pipe between integers. In regex pipe means “or” but I need it in my string..
[1-2][\|][1-2][\|][1-2] is what I came up with. Is this logical or are there any better options?
I would use:
So you catch both 1 and 2 and have them in a group for future usage.
The minus sign is not nessesary, because there is no character possible in ASCII between
1and2.