Answer the question
In order to leave comments, you need to log in
How to write a regular expression to replace by keys from an object?
How to write a regular expression so that it replaces strings with a value from an object?
Given a template:
An object with the desired values:
const template = "{label} {text} {...}"
const obj = {
label: 'some label',
text: 'some text'
}
const newStr = 'some label some text'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question