If you want to partition the elements to - "-configfile"(don't capture), "file"(capture), "-r"(don't capture), "number"(capture), use just parentheses where you want to capture and leave the rest outside of it. Also, 2 is the whole match, even what you don't want to capture.