I wrote a regular expression that will replace odd number of slashes by an even number of slashes while leaves the even number of slashes intact. But for some reason I am getting an error:
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);
This is the exception:
Exception in thread "main" org.apache.regexp.RESyntaxException: Syntax error: Missing operand to closure
this works fine:
maybe your RE expects something different