偶数のスラッシュで奇数のスラッシュを置き換え、偶数のスラッシュをそのまま残す正規表現を書いています。しかし、私はエラーを取得しています何らかの理由:正規表現に問題はありますか?
int matchFlags = StringUtil.MATCH_SINGLELINE;
int replaceFlags = StringUtil.REPLACE_ALL + StringUtil.REPLACE_BACKREFERENCES;
String pattern = "(?<!/)/(//)*(?!/)"; //replace odd # of slashes only.
String replace = "$0$0";
RE re = new RE(pattern, matchFlags);
result= re.subst(result, replace, replaceFlags);
これは例外です:
Exception in thread "main" org.apache.regexp.RESyntaxException: Syntax error: Missing operand to closure
あなたの質問にHTMLを使用しないでください。代わりに[Markdown](http://stackoverflow.com/editing-help)を使用してください。 – adarshr
チップが – Wael
奇数/スラッシュ///の//ありがとう、ありがとう/// ////".replaceAll("(? beerbajay