Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The approximate grep (agrep) bitwise string search algorithm in Go (bugfix-66.com)
2 points by bugfix-66 on Oct 7, 2022 | hide | past | favorite | 1 comment


This is the Bitap (or Shift-And) algorithm described here:

https://en.m.wikipedia.org/wiki/Bitap_algorithm

Change

  maybe := prefixes << 1
to

  maybe := prefixes<<1 + 1
to fix the bug.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: