Matching optional capture groups in any order
问题 There are many situations in parsing user input where the user has the opportunity to add several optional flags to the input which should be accepted in any order. How can this be parsed with regex so that each flag will be in it's own capture group if it is present? For example: There is a required token a , and then 3 optional tokens which can come in any order b , c , and d . Some acceptable inputs would be: a a b a c a b c a c b a b c d a d b c a c d b The capture groups should always