RegEx 如何在两个字符串之间查找文本 [英] RegEx How to find text between two strings
本文介绍了RegEx 如何在两个字符串之间查找文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个文本,我想捕捉
I have this text and I want to capture
begin
text
end
begin
text
end
begin
text
end
开始和结束之间的文本.
the text between the begin and end.
/begin.*end/
这将捕获第一个开始和最后一个结束.
this will capture the first begin and the last end.
推荐答案
让它变得懒惰 - /begin.*?end/
Sidenote: "lazy" is no less acceptable than "non-greedy" is. Example, example, example
这篇关于RegEx 如何在两个字符串之间查找文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文