I'm using regex to find all selectors in CSS files and sometimes, it loads for minutes. After looking at the files, I found out that the sourceMappingURL is really large and cause the issue:
sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndvb2QuZnVsbC5taW4uY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJpQkFFQSw4QkFBOEIsU0FBUyxPQUFPLGlCQUFpQixPQUFPLEtBQUssb0JBQW9CLEtBQUssUUFBUSxPQUFPLEVBQUUsU0FBUyxtQkFBbUIsSUFBSSxRQUFRLFdBQVcsT0FBTyxvQkFBb0IsNEJBQTRCLE9BTyxL...
Here's the full CSS file: https://jsfiddle.net/jj_jaq/32d7hpc0/3/
Here's my regex:
selectors = re.findall(r'([.#\w][-\w,\s.]+)(\{(.*?)\})', content)
Is there a way to speed up my regex?