in reply to count backrefenence regex

I wonder if this would be better achieved with a suffix tree and/or stemming