ruby - gsub variable regardless of case -
i have following code set highlight parts of phrase word is. function regardless of case struggling syntax. believe need add /i somewhere, not know where.
params.fetch('phrase').gsub(params.fetch('word'), '<span class="ko-highlight">' + params.fetch('word') + '</span>')
this should trick
params.fetch('phrase').gsub(/#{params.fetch('word')}/i, '<span class="ko-highlight">' + params.fetch('word') + '</span>')
Comments
Post a Comment