不管什么都要记录一下,也是服了我自己

对正则表达式不了解,遇到一个问题需要匹配最外层大括号的内容,绞尽脑汁,无果

后来解决了:

female{{initiator} updated {person}’s role to {role}}

 

最外层正则表达式:

(?<=\{).*(?=\})
共找到 1 处匹配:
{initiator} updated {person}’s role to {role}

最内层正则表达式:

{[^{}]+}
共找到 3 处匹配:
{initiator}
{person}
{role}

 

相关文章:

  • 2022-01-18
  • 2021-08-27
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-02-16
  • 2021-06-02
  • 2022-02-07
猜你喜欢
  • 2021-10-27
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案