+ 1

Python Regular Expressions

Does anybody know/explain what the following python regular expressions match? r'\

lt;\d+>[/*]?' r'\$\$|\${\w+}'

26th Jul 2020, 11:16 PM
Edward Finkelstein
Edward Finkelstein - avatar
2 Antworten
+ 2
I will try to answer by adding some cases. r"\
lt;\d+>[/*]?" matchs:
lt; continuous with one and more digit then, > zero or one / or * Example:
lt;1>
lt;2>/
lt;007>* r"\$\$|\${\w+}" matchs: 1st Alternative \$\$: $ 2nd Alternative \${\w+}: ${ [a-zA-Z0-9_] one or more times } Example: $ ${iOS_11} You might also want to check out this online regex tester, https://regex101.com Hope this helps.
27th Jul 2020, 3:34 AM
Esch
Esch - avatar
+ 1
Esch Thank you very much. It makes much more sense now.
27th Jul 2020, 6:33 AM
Edward Finkelstein
Edward Finkelstein - avatar