Matching nested [quote] in using RegExp
问题 I'm trying to get regexp to match some nested tags. (Yes I know I should use a parser, but my input will be correct). Example: Text. More text. [quote] First quote [quote] Nested second quote. [/quote] [/quote] Let's say I want the regexp to simply change the tags to <blockquote> : Text. More text. <blockquote> First quote <blockquote> Nested second quote. </blockquote> </blockquote> How would I do this, matching both opening and closing tags at the same time? 回答1: You can't match