Complex Python Regex for Django View
(.*\/)([^\/]*)$ will put the page in $2 and something you'll have to parse in $1.
OP added:
The above did the trick. For reference, the full regex became (multi-lined for readability):
^(?P<domain>[a-zA-Z0-9\_\-]*)/
  (?P<version>[a-zA-Z0-9\-\_\.]*)/
  (?P<collections>.*)/
  (?P<page>[^\/]*)$
URL structure look liks this: <domain>/<version>/<collection>/<sub-collection>/<page> where domain is anything a-zA-Z0-9\-\_, version is anything a-zA-Z0-9\-\_\. (But would likely be only 1.0, 1.1, 2.0.0 etc) and both collection and sub-collection are optional groups which follow <domain> restraints.
Current regex is: r'^(?P<domain_slug>[a-zA-Z0-9\-\_]*)\/(?P<version_slug>[a-zA-Z0-9\-\_\.]*)\/(?P<slug>[a-zA-Z0-9\-\_]+)\/$.
How can I capture optional positions, ensuring the last segment is always the page?
Additionally, is this even a good idea? Would it be better to just pass this through the Django URL conf and let a view function handle all the work?
Example URLs could include:
administration/5.0.3/reset-user-password
user/1.0/getting-started/setting-up-an-account
development/3.2/authentication/acl/creating-aco