Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String matching in Python

does anyone know which string matching algorithm is implemented in Python?

like image 255
Paul Avatar asked Jan 22 '26 01:01

Paul


2 Answers

Per the sources, it's a

fast search/count implementation, based on a mix between boyer-moore and horspool, with a few more bells and whistles on the top. for some more background, see: http://effbot.org/zone/stringlib.htm

The essay in question is really well worth reading!

like image 165
Alex Martelli Avatar answered Jan 24 '26 17:01

Alex Martelli


I assume you're talking about CPython. In that case, you could always check the source (see fastsearch.h).

like image 27
BlueRaja - Danny Pflughoeft Avatar answered Jan 24 '26 17:01

BlueRaja - Danny Pflughoeft