我正在编写一个Lucene应用程序来匹配&&(双&符号)和||(OR或双管道).
我想写一个正则表达式来匹配输入文本中的任何&&和||.
如果我写的东西象下面,它只是相匹配的存在与否&&不是||.
String inputTextFromFile = "This text contains double ampersand &&, and double pipe || and can this be recognised ? ";
Pattern pattern = Pattern.compile("(?=&&)(?= ||)");
Matcher matcher = pattern.matcher(inputTextFromFile);
Run Code Online (Sandbox Code Playgroud)
请让我知道我如何能够完全匹配&&或||在输入文本中.