使用属性文件中的正则表达式为假

False with regular expression from properties file

所以这是我的问题。我在 Java 中有类似评论的字符串:

String s = "// the "then" clause: decrease"

当我这样做时:

System.out.println(s.matches("(^(//).+)"));

true。 但是,当我有属性文件时,

listing = "(^(//).+)"

并做同样的事情

System.out.println(s.matches(resourceBundle.getString("listing")));

我收到 false。为什么?什么正则表达式必须在属性中才能接收到 true?谢谢

删除属性文件中的引号。

listing = (^(//).+)