diff --git a/core/src/main/java/hudson/MarkupText.java b/core/src/main/java/hudson/MarkupText.java index 478b4bb317306a6c7d1533f4e3ca892bebea24b6..619e2a4a8d4b9566b9d38de4b22f4d7f2a6b0423 100644 --- a/core/src/main/java/hudson/MarkupText.java +++ b/core/src/main/java/hudson/MarkupText.java @@ -171,13 +171,18 @@ public class MarkupText extends AbstractMarkupText { } else if (ch == '$') {// replace by group i++; + ch = s.charAt(i); // get the group number - int groupId = s.charAt(i) - '0'; + int groupId = ch - '0'; + if (groupId < 0 || groupId > 9) { + buf.append('$').append(ch); + } else { + // add the group text + String group = group(groupId); + if (group != null) + buf.append(group); + } - // add the group text - String group = group(groupId); - if (group != null) - buf.append(group); } else { // other chars buf.append(ch);