You are correct. I've updated the gists and text accordingly.
The Ruby example was already correct.
The Ruby example was already correct.
(words - @@nouns).each do |w|
text.gsub!(/(\b)#{w}(\b)/i, '\1<span class="nurble">nurble</span>\2')
end
EDIT: oops, backslash. Also, in the example, line 19, where you have 'sub', don't you mean 'pattern'?And thanks for the typo catch, too.
And, just FYI you do need to escape the backrefs or use single quotes, like:
"\\1<span class=\"nurble\">nurble</span>\\2"