Ok, my previous questions were answered ... I have one more, this one is more difficult for me...
^([A-Za-z]+\.[A-Za-z0-9_-]+\.domain\.com)$
Right now this expression produces only 1 capture group as noted with ^() ; How would I do 2 capture groups for this URL? (for IIS regular expression rewrite)
You can do this by enclosing the relevant portions like so:
text = "city.state.domain.com"
pattern = "^([^\.]+).([^\.]+).([^\.]+).([^\.]+)$"
match = re.match(pattern, text)
match.groups()
# Returns: [ 'city', 'state', 'domain', 'com' ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With