▁original ▁algorithm ▁is ▁ ▁in ▁the ▁worst ▁case . ▁This ▁is ▁easy ▁to ▁see ▁when ▁both ▁pattern ▁and ▁text ▁consist ▁sole ly ▁of ▁the ▁same ▁repeated ▁character . ▁However , ▁inclusion ▁of ▁the ▁Gal il ▁rule ▁results ▁in ▁linear ▁runtime ▁across ▁all ▁cases . ▁ ▁Im plement ations ▁Vari ous ▁implementations ▁exist ▁in ▁different ▁programming ▁languages . ▁In ▁C ++ ▁it ▁is ▁part ▁of ▁the ▁Standard ▁Library ▁since ▁C ++ 1 7 , ▁also ▁Bo ost ▁provides ▁the ▁generic ▁Bo yer – Mo ore ▁search ▁implementation ▁under ▁the ▁Algorithm ▁library . ▁In ▁Go ▁( programming ▁language ) ▁there ▁is ▁an ▁implementation ▁in ▁search . go . ▁D ▁( programming ▁language ) ▁uses ▁a ▁Bo yer Mo ore F inder ▁for ▁predicate ▁based ▁matching ▁within ▁ranges ▁as ▁a ▁part ▁of ▁the ▁Ph ob os ▁Runtime ▁Library . ▁ ▁The ▁Bo yer – Mo ore ▁algorithm ▁is ▁also ▁used ▁in ▁GNU ' s ▁grep . ▁ ▁Below ▁are ▁a ▁few ▁simple ▁implementations . ▁[ Python ▁implementation ] ▁from ▁typing ▁import ▁* ▁# ▁This ▁version ▁is ▁sensitive ▁to ▁the ▁English ▁alphabet ▁in ▁ASCII ▁for ▁case - ins ens itive ▁matching . ▁# ▁To ▁remove ▁this ▁feature , ▁define ▁alphabet _ index ▁as ▁ord ( c ), ▁and ▁replace ▁instances ▁of ▁" 2 6 " ▁# ▁with ▁" 2 5 6 " ▁or ▁any ▁maximum ▁code - point ▁you ▁want . ▁For ▁Unicode ▁you ▁may ▁want ▁to ▁match ▁in ▁UTF - 8 ▁# ▁bytes ▁instead ▁of ▁creating ▁a ▁ 0 x 1 0 FFFF - s ized