DEV Community


Discussion on: The algorithm behind Ctrl + F.

johnphamous profile image
John Pham • Edited

Great write up on the different string matching algorithms!

The algorithm which we will implement might be similar to the one used in Chrome, but since its Google we're talking about, they might've made optimizations

The source code for the find in page is actually open source! You can see how it's implemented here:

Actual implementation:

Looks like they swap in different algorithms based on the context.

akhilpokle profile image
Akhil Author

OMG ! thanks for sharing :). I read on StackOverflow that somewhere around 2008-2010 when chrome was picking of, they shared how they've implemented a version of Boyer Moore's pattern matching algorithm. But I couldn't find it on youtube.