[英]Regex - returning overlapping matches
How do I change this regular expression: 如何更改此正则表达式:
(`)([^`]+)`|(\*)([^*]+)\*
To give an output like this: 给出这样的输出:
` | hel*low
* | low`orld
* | hello
` | world
When passed: 通过时:
"`hel*low`orld* *hello* `world`"
You can use this pattern: 您可以使用此模式:
(?=([`*])((?>[^`*\W]++|(?!\1)[`*])+)\1)
or this pattern: 或这种模式:
(?=([`*])((?:[^`*\W]+|(?!\1)[`*])+)\1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.