regex在更新后更新symfony呈现标记签名

regex在更新后更新symfony呈现标记签名,regex,symfony,twig,Regex,Symfony,Twig,symfony更新后,渲染标记签名已更改: 之前: {% render 'BlogBundle:Post:list' with { 'limit': 2 }, { 'alt': 'BlogBundle:Post:error' } %} 之后: {% render controller('BlogBundle:Post:list', { 'limit': 2 }), { 'alt': 'BlogBundle:Post:error' } %} {# Or: #} {{ render(control

symfony更新后,渲染标记签名已更改:

之前:

{% render 'BlogBundle:Post:list' with { 'limit': 2 }, { 'alt': 'BlogBundle:Post:error' } %}
之后:

{% render controller('BlogBundle:Post:list', { 'limit': 2 }), { 'alt': 'BlogBundle:Post:error' } %}
{# Or: #}
{{ render(controller('BlogBundle:Post:list', { 'limit': 2 }), { 'alt': 'BlogBundle:Post:error'}) }}
我正在寻找一种使用正则表达式自动修改调用的方法。 有人能帮忙吗?

替换:

\{% render ([^,%]*?), ([^%]*?)%\}
与:


什么是输入,什么是期望的输出?对不起,我不清楚你的问题真的值得吗?代码中有多少位置必须固定?'BlogBundle:Post:list'、'limit':2、'alt':'BlogBundle:Post:error'是可选输入。我有大约50个条目需要修改。另外,当切换到新版本live时,我希望尽可能减少停机时间。这假设始终有一个逗号和两个需要更换的部分。它适用于您的示例,但您可能应该检查是否有其他形式的输入。太好了,谢谢。我试试看
{% render controller(\1), \2%}