0
正则表达式对我来说是新的(但它们是美好而有用的:D)。但是,在尝试在TextMate中使用它们之后,我得到了意想不到的结果。我不确定这是一个错误还是正则表达式的工作原理。TextMate中的正则表达式问题
我有这样的代码
begin text in the middle end and more text and a
second begin second text in the middle end
与begin.+end
搜索我希望两个结果
begin text in the middle end
和begin second text in the middle end
但我得到的选择了整个文本;我期望begin.+end
搜索.+
,直到找到第一个end
,但它搜索直到最后一个。
这是他们如何工作?我在哪里可以学习如何使用正则表达式?
事实是,我很感兴趣,只是选择内部.+
没有begin
和end
但这是另一个问题。
关键是'。+?';)剩下的就是我需要学习的东西。 – Manuel
@Manuel增加了exp为'。+?' –
在本演示中添加和删除'?'可以看出区别http://regex101.com/r/oX4qT1/3 –