How do I find the shortest overlapping match using regular expressions?

前端 未结 9 1122
無奈伤痛
無奈伤痛 2020-12-15 08:03

I\'m still relatively new to regex. I\'m trying to find the shortest string of text that matches a particular pattern, but am having trouble if the shortest pattern is a sub

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 08:19

    I do not think that this task can be accomplished by a single regular expression. I have no proof that this is the case, but there are quite a lot of things that can't be done with regexes and I expected this problem to be one of them. Some good examples of the limitations of regexes are given in this blog post.

提交回复
热议问题