用于匹配和替换 **someVal** 的正则表达式 <b>someVal</b>

Regex to match and replace **someVal** in to <b>someVal</b>

我有以下输入:

**1** Blah  **3** Blah

期望输出:

<b>1</b> Blah  <b>3</b> Blah

基本上我正在尝试使用以下带有自由标记的正则表达式来用 替换前导 **

/\*\*([^\*]+)\*\*

https://regex101.com/r/aX0xL6/2

我对如何替换相应的 的 ** 有点困惑....然后我需要在 freemarker 中弄清楚。

这应该比您已经发布的正则表达式更好用。

\*{2}(.+?)\*{2}

替换代码为:

<b></b>

演示:https://regex101.com/r/aX0xL6/3