I am trying to use python regex in a URL string.
id= 'edu.vt.lib.scholar:http/ejournals/VALib/v48_n4/newsome.html'
>>> re.search('news|ejournals|theses',id).group()
'ejournals'
>>> re.findall('news|ejournals|theses',id)
['ejournals', 'news']
Based on the docs at http://docs.python.org/2/library/re.html#finding-all-adverbs he says that search () matches the first and finds all possible matches in a string.
I wonder why 'news' is not captured by the search, even if it is declared first in the template.
Did I use the wrong template? I want to search if any of these keywords appears in a string.
source
share