title: Dollar sign replacement not working Java
body: <p>Okay so I've been reading posts(alot) about the <code>$</code> sign in java and regex and stuff. But for some reason, each time I try to replace it, it gives me an <code>IndexOutOfBoundsException</code>.</p>
  
  <p>I'm trying to parse a string begining with a <code>$</code> sign into an integer.</p>
  
  <p>When I do <code>$test</code> it gives me a <code>NumberFormatException</code> (which is what I want) but when I do <code>$5</code> it gives me the other Exception (<code>IndexOutOfBoundsException</code>) although i'm changing it to <code>\0024</code> and adding in the number following it... Anyone mind helping me? Thanks!</p>
  
  <pre><code>if (w.charAt(0) == '$') {
      try {
          w = w.replace("\u0024", "");
          int i = Integer.parseInt(w);
          m.appendReplacement(sb, ChatTweaks.Citrus.get("dollarIn") + "" + '\u0024' + i);
      } catch (NumberFormatException nume) {
          ChatTweaks.showMsg(ChatTweaks.prefix + "Please use numbers after your dollar signs ($)w=" + w);
          return;
      } catch (Exception ex){
          ChatTweaks.showMsg(ChatTweaks.prefix + "Unknown exception ex: " + ex + " w:" + w);
      }
  }
  </code></pre>