Real-time string matching
Python 2, 495 bytes

This one is a real-time KMP, which is a lot shorter and only slightly slower than the BMG algorithm (which is usually sublinear). Call with K(pattern, text); output is identical to the BMG algorithm.

L,R,o=len,range,lambda x:ord(x)-97
def K(P,T):
 M,N=L(P),L(T);Z=[0]*M;Z[0]=M;r=l=0
 for k in R(1,l):
    if k&gt;r:
     n=0
     while n+k&lt;l&lt;P[n]==P[n+k]:n+=1
     Z[k]=n
     if n&gt;0:l,r=k,k+n-1
    else:
     p,_=k-l,r-k+1
     if Z[p]&lt;_:Z[k]=Z[p]
     else:
        i=r+1
        while i&lt;M&lt;P[i]==P[i-k]:i+=1
        Z[k],l,r=i-k,k,i-1
 F=[[0]*26]*M
 for j in R(M-1,0,-1):z=Z[j];i,x=j+z-1,P[z+1];F[i][o(x)]=z
 s=m=0
 while s+m&lt;N:
    c=T[s+m]
    if c==P[m]:
     m+=1
     if m==M:print s,;s+=1;m-=1
    else:
     if m==0:s+=1
     else:f=F[m][o(c)];s+=m-f;m=f