我有一个字符串,如下如何使用正则表达式中使用的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