-
Bug
-
Resolution: Unresolved
-
P5
-
26
```
nodeRegex = nodeRegex.replaceAll(IRNode.IS_REPLACED, userPostfix.value());
```
because in RawIRNode.java, \ and $ in arguments of parametric rules of IR framework are not replaced textually but interpreted as replacement for matched groups.
This is problematic for nested classes (using $) and for actually writing regexes: for instance, if we want to match any classes of name "MyValue" followed by digits one must write:
@(failOn = {ALLOC_OF, "MyValue\\\\d+"}
the 4 \ means only 2 \ in the String value, which is an escaped \ for replaceAll. But in the substitution
```
nodeRegex = nodeRegex.replaceAll(IRNode.IS_REPLACED, userPostfix.value());
```
the replacement feature is useless since IS_REPLACED has no capturing group. We should use java.util.regex.Matcher.quoteReplacement to escape \ and $ not to have to do it manually.
nodeRegex = nodeRegex.replaceAll(IRNode.IS_REPLACED, userPostfix.value());
```
because in RawIRNode.java, \ and $ in arguments of parametric rules of IR framework are not replaced textually but interpreted as replacement for matched groups.
This is problematic for nested classes (using $) and for actually writing regexes: for instance, if we want to match any classes of name "MyValue" followed by digits one must write:
@(failOn = {ALLOC_OF, "MyValue\\\\d+"}
the 4 \ means only 2 \ in the String value, which is an escaped \ for replaceAll. But in the substitution
```
nodeRegex = nodeRegex.replaceAll(IRNode.IS_REPLACED, userPostfix.value());
```
the replacement feature is useless since IS_REPLACED has no capturing group. We should use java.util.regex.Matcher.quoteReplacement to escape \ and $ not to have to do it manually.