Reputation: 295
I am having a problem. I am trying to match only the 2nd file.
ERIC_KM_NOW_SYSTEMIC_17001900_data.html
ERIC_KM_NOW_17001900_data.html
import re
viewTag = "KM_NOW"
regex = re.escape(viewTag) + r'(\d{8})' + re.escape('_data')
test = re.search(regex, "ERIC_KM_NOW_17001900_data.html")
print(test)
is that not correct? I get type 'None'
Upvotes: 1
Views: 55
Reputation: 72241
You forgot a _
after KM_NOW
.
(Hint: print(regex)
to see it easily next time. ;-))
Upvotes: 3