Skip to content

Instantly share code, notes, and snippets.

@chekit
Created July 2, 2017 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chekit/023d7722803a3169664f4c2181003529 to your computer and use it in GitHub Desktop.
Save chekit/023d7722803a3169664f4c2181003529 to your computer and use it in GitHub Desktop.
Для замены нескольких совпадений в тексте на нужный шаблон можно использовать метод replace
let text = 'test'.replace(/t/gi, '<span>$&</span>');
// text = "<span>t</span>es<span>t</span>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment