Answer the question
In order to leave comments, you need to log in
Problem with brackets in regular expressions, what's wrong?
const object = {
Component: 'Component Yes',
Composer: 'Composer Yes'
}
let string = "{{Component}} {{Composer}}"
string = string.replace(/\{\{(.*?)\}\}/, object[$1])
// Undefined undefined
// Я хочу достать то что выполнилось в скобках, разве для этого $1 не нужен?
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