Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以进行正则表达式仅匹配值之前的最后一个星号和值之后的第一个星号?
价值:**example**
**example**
我的实际正则表达式:/\*(.*?)\*/g
/\*(.*?)\*/g
我的实际正则表达式匹配单词示例之前和之后的两个星号,但我想做一个正则表达式,它只匹配单词之前的最后一个星号和单词之后的第一个星号。
谢谢!
尝试/[*][^*]+[*]/gm
/[*][^*]+[*]/gm
在 regex101.com 上进行测试