-2

I mean what algorithm does it use to search? (behind) if it's hash? then its always better to compile the string first and use it for search in later point of time, rather than calling re.match every time against whole string

Please share your thoughts.!

1 Answers1

1

In CPython, compiled patterns appear to be cached.

Unclear from your question, but if you are asking about how regular expressions work, you can start here to get an idea and find more reading materials. I tried it once, and there's actually enough information in Wikipedia articles to get to the point where you build your own simple regex parser.

Vlad
  • 18,195
  • 4
  • 41
  • 71