Freemarker 正则表达式不适用于组?
Freemarker regular expression not working for groups?
我有一个有效的 reg ex -> https://regex101.com/r/aX0xL6/3
基本上转换输入->输出
输入:
**1** Blah **3** Blah **I am * all bold**
期望的输出:
<b>1</b> Blah <b>3</b> Blah <b>I am * all bold</b>
但是,我似乎无法弄清楚如何让它在 freemarker 上工作?
${stringStuff?replace("\*{2}(.+?)\*{2}\", "<b></b>", "r")}
see link for working example and details for basic regex match and replace
这成功了!
<#if lineItem?has_content>${stringStuff?replace("\*{2}(.+?)\*{2}", "<b></b>", "r")}</#if>
我有一个有效的 reg ex -> https://regex101.com/r/aX0xL6/3
基本上转换输入->输出
输入:
**1** Blah **3** Blah **I am * all bold**
期望的输出:
<b>1</b> Blah <b>3</b> Blah <b>I am * all bold</b>
但是,我似乎无法弄清楚如何让它在 freemarker 上工作?
${stringStuff?replace("\*{2}(.+?)\*{2}\", "<b></b>", "r")}
see link for working example and details for basic regex match and replace
这成功了!
<#if lineItem?has_content>${stringStuff?replace("\*{2}(.+?)\*{2}", "<b></b>", "r")}</#if>