So I have this regex:
(^(\\s+)?(?P(\\w)(\\d{7}))((01f\\.foo)|(\\.bar|\\.goo\\.moo\\.roo))$|(^(\\s+)?(?PR1_\\d{6}_\\d{6}_)((01f\\.foo)|(\
No, you can't have two groups of the same name, this would somehow defy the purpose, wouldn't it?
What you probably really want is this:
^\s*(?P\w\d{7}|R1_(?:\d{6}_){2})(01f\.foo|\.(?:bar|goo|moo|roo))$
I refactored your regex as far as possible. I made the following assumptions:
You want to (correct me if I'm wrong):
"R1_"
, and two times (6 digits + "_"
)"01f.foo"
or"."
and ("bar"
or "goo"
or "moo"
or "roo"
)You could also have meant:
^\s*(?P\w\d{7}01f|R1_(?:\d{6}_){2})\.(?:foo|bar|goo|moo|roo)$
Which is:
"R1_"
, and two times (6 digits + "_"
)"foo"
, "bar"
, "goo"
, "moo"
or "roo"