Python regex - difference between search and find all
You're thinking about it backwards. The regex goes through the target string looking for "news"
OR "ejournals"
OR "theses"
and returns the first one it finds. In this case "ejournals"
appears first in the target string.
The re.search()
function stops after the first occurrence that satisfies your condition, not the first option in the pattern.