Here is the text
<some string here could contain W or L letter><W1>123<W2>123<W3>123. 
I hope to replace
<W(number)> 
pattern to
<L(number)>
pattern.
String str = "<WLWLWL><W1><FS>123<W2><FS>345<E>";
    System.out.println(str);
    Pattern p = Pattern.compile("<[A-Z]\\d>");
    Matcher m = p.matcher(str);
    while(m.find()){
        System.out.println(m.group());
    }
    str.replaceAll("<[A-Z]\\d>", "<L\\d>");
    System.out.println(str);
I can find exactly what I want with code above but the replace is not working.
I suppose the replace string doesn't take the regex in it. So what's the best way to do it?
 
     
    