好吧,那么,假设我有一些短信,比如:
Any random content here
{{mycontent
more content goes here
{{curly braces may also appear in here}}
{even single ones}
}}
And more content goes here...我需要获取{{mycontent与其相应的}}结尾括号之间的部分。
在RegEx (这是必修课),你会怎么做呢?
发布于 2014-01-26 10:23:31
/\{{2}(.*)\}{2}/s
这将匹配包括新行在内的2个大括号之间的任何内容。
结果将是
0 => string '{{mycontent
more content goes here
{{curly braces may also appear in here}}
{even single ones}
}}'https://stackoverflow.com/questions/21362203
复制相似问题