How to optimize the performance of Python regular expression?

PythonServer Side ProgrammingProgramming

Regular expressions make our job of filtering out patterns in word processing easy. One good thing about regular expressions is that they can be compiled and reused for faster results. Since regular expressions don't change across function calls, we can compile it once and use the compiled version. This however comes at a cost and a balance must be struck to optimize the performance.

It is also found that using 'in' operator in regular expressions speeds up the work. 

Regular expressions are relatively difficult to debug and maintain and have performance issues. These issues must be tackled to optimize their performance

raja
Published on 11-Jan-2018 11:46:49
Advertisements