May-04-2020, 07:02 AM
As a alterative an other regex,also using
not that make so much difference with this kind of file size.
finditer()
and compile()
can speed stuff up,not that make so much difference with this kind of file size.
import re with open('access_log.txt') as f: log = f.read() pattern = re.compile(r"/\w*.\.js.*\.js|\/\w*.\.js") for match in pattern.finditer(log): print(match.group().lstrip('/'))
Output:jquery.jshowoff.min.js
jquery.js
jquery.jshowoff.min.js
jquery.js
jquery.js
jquery.js
jquery.jshowoff2.js
jquery.jshowoff.min.js
jquery.js
jquery.jshowoff.min.js
jquery.js
jquery.js
jquery.js
jquery.js