Aptana Studio 3查找/替换RegEx不替换捕获文本

时间:2013-05-03 23:32:03

标签: regex aptana

使用Aptana Studio 3我使用^(.+)$成功捕获了文本行,并使用<p>\1</p>替换了找到的表达式。

例如: This is a line of text.会产生<p>This is a line of text.</p>

但是,当我尝试将Note - this is a line of text中的“注释”替换为<strong>Note</strong>时。

^(.+)(?= -)选择上面示例中“ - ”(单词“Note”)之前的所有文字,但

&LT;强&GT; \ 1·/强&GT; 不会将其替换为<strong>Note</strong> 在尝试了一些在线资源后,我得到了&lt; strong&gt; $ 0&lt; / strong&gt;在线工作但不在Aptana工作。有人有解决方案吗?

顺便说一下,“Note”是我能提供的最简洁的例子。许多行包含“ - ”之前的多字短语。

1 个答案:

答案 0 :(得分:2)

有什么奇怪的! Aptana似乎不允许在使用前瞻(可能是一个bug)时进行任何替换,但无论如何都要匹配。我在Aptana Studio 3上重现了它,版本:3.4.0.201304151603。请注意,lookbehind没有问题。

您可以使用:

find:    ^(.+)( -)
replace: <strong>\1</strong>\2

[编辑]

这是一个知道错误:Eclipse regex search/replace not replacing after regex positive look-ahead?