{0}{5} {1}{dfdf} {2}{пара, пара п.а пара&па®} {3}{dfdf!} regex {([\ s \ S] +?)} selects with curly braces, how to exclude brackets leaving only the content?
{0}{5} {1}{dfdf} {2}{пара, пара п.а пара&па®} {3}{dfdf!} regex {([\ s \ S] +?)} selects with curly braces, how to exclude brackets leaving only the content?
If I understand the question correctly, you can do so
[^\{\}] Result http://regexr.com/3eonp . I'm afraid of the complexity of some answers, I do not understand something in the question?
You can use direct (?=) And reverse (?<=) View
(?<=\{)([\s\S]+?)(?=\}) You can see here
Another option is to take only the group in brackets. If the expression is used for search and replace, you can replace with {$1}
Just take the first group from the result:
var res = []; `{0}{5} {1}{dfdf} {2}{пара, пара п.а пара&па®} {3}{dfdf!}`.replace(/\{([\s\S]*?)\}/g, (m, g) => { res.push(g) }); console.log(res); Source: https://ru.stackoverflow.com/questions/596841/
All Articles