我有一個字符串,如下如何使用正則表達式中使用的Java
when
$Event:com.abc.Event(description == "abc")
then
logger.info("description");
我需要使用以下
when
$Event:com.abc.Event(description == "abc") from entry-point "EventStream"
then
logger.info("description");
替換上面的字符串以同樣的方式時,我遇到
替換特定的字符串when
$Alarm:com.abc.Alarm(description == "abc")
then
logger.info("alarm description");
我需要改變如下
when
$Alarm:com.abc.Alarm(description == "abc") from entry-point "AlarmStream"
then
logger.info("alarm description");
我想使用正則表達式使用貪婪匹配替換字符串。 請給我一些指示,以達到同樣的效果。
感謝您的更新。但在我的情況下,問題是「.Event(」和「)」在第一種情況下,「.Alarm(」和「)」將保持不變,當部分,所以我不想去確切的字符串比較。 – mohan
@gsr我已經爲您做出了一個新的答案,看看是否符合您的要求。 – Farmor