Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var text = 'This is the text to replace !!value to replace!!!';
- text = replaceTenuis(text, '<a href="">KEYFIND</a>', 'KEYFIND');
- function replaceTenuis(toReplace, replaceWith, replaceKey) {
- return toReplace.replace(
- /(?:!{2})([\w\s\d]+)(?:!{2})/i,
- function(fullMatch, keyMatch) {
- return replaceWith.replace(replaceKey, keyMatch);
- });
- }
- console.warn(text);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement