I'm still quite unfamiliar with Python, albeit I have quite a bit of experience with JavaScript, so it's really only the idiosyncrasies of Python that I need to work on. Considering that, and the fact that I know there are some subtle differences between JS RegEx and Python RegEx, I have a question about a Python RegEx statement. Is there any way to make the following statement more concise?
The Whole Regular Expression
^https://www.indiegogo.com/explore/[a-z]+-?[a-z]+\?project_type=[a-z]+&project_timing=[a-z]+_?[a-z]+&tags=&sort=trending$
^https://www.indiegogo.com/explore/[a-z]+-?[a-z]+\?project_type=[a-z]+&project_timing=[a-z]+_?[a-z]+&tags=&sort=trending$
Breakdown of the Whole Regular Expression
I'll break this down further for you. The URL address will always begin with ^https://www.indiegogo.com/explore/ and always end with &tags=&sort=trending$, so no need to worry about this, but...
[a-z]+-?[a-z]+\?project_type=[a-z]+&project_timing=[a-z]+_?[a-z]+
...is the specific part of the regular expression that matters, which can be broken down even further.
URL Structure and Possible Formats of Dynamic Values
^https://www.indiegogo.com/explore/wordordash-separatedorseparated-by-dashesorwords-separated-by-dashes?project_type=word&project_timing=wordoradditional_word&tags=&sort=trending$
Steps 1., 3., 5., and 7. can be ignored altogether, which leaves us with...
The Only Dynamic Values
2. word or dash-separated or separated-by-dashes or words-separated-by-dashes
6. word or additional_word
It may be my own ignorance or inexperience, but the regular expression I've devised seems clunky so to speak. Is there any way to improve this regular expression?!
urlparse.