Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
因此,如果我想通过 JFlex 的正则表达式键入箭头字符 -->,我会认为它只是字符串“-->”。但是,如果我尝试这样做,我总是会收到无法匹配输入错误。
"-->" {}
不工作。据我所知,转义某些字符的组合也没有。我知道这些字符中的每一个在 flex 中都是特殊的,而且我知道 /-->/ 在其他语言中工作的文字方式在 Java 中是不会的。
我错过了什么?
如果我理解正确,您是在尝试查找“-->”的匹配项吗?如果是这样,则表达式[\-\-\>]+填充找到该匹配项。
[\-\-\>]+
在http://www.regexplanet.com/advanced/java/index.html测试