Я хочу захватить согласованные фигурные скобки.Regex: захват парных фигурных скобок
Например:
Some example text with \added[author]{text with curly braces{some text}..}
Some example text with \added[author]{text without curly braces}
Some example text with \added[author]{text with {}and {} and {}curly braces{some text}..}
Some example text with \added[author]{text with {}and {} and {}curly braces{some text}..} and extented text with curly braces {}
Ожидаемые результаты:
Some example text with text with curly braces{some text}..
Some example text with text without curly braces
Some example text with text with {}and {} and {}curly braces{some text}..
Some example text with text with {}and {} and {}curly braces{some text}.. and extented text with curly braces {}
т.е. я хочу, чтобы захватить текст между \added[]{
и }
(его относительная закрывающие фигурные скобки) .Problem с моей регулярное выражение, Я не знаю, как захватить связанные фигурные скобки.
Я попытался,
"/\\\\added\\[.*?\\]{(.[^{]*?)}/s"
Я знаю, что он игнорирует, если {
присутствует в тексте. Но я не понимаю, как создать регулярное выражение, чтобы получить согласованные фигурные фигурные скобки.
Пожалуйста, ребята, помогите мне с моим вопросом по адресу http://stackoverflow.com/questions/33841196/how-to-match-text-inside-starting-and-closing-curly-brace-the-tags-and-the -спец –