I have a some strings where I need to replace \L and \l where there is a starting \L and ending \l Example:
Some Text \LThis is \\L What I want \\l and this\l Some more Text
I need to take into account where \L or \l can be double escaped to (\L or \l) to actually mean \L.
I want the above to come out as:
Some Text This is \L What I want \l and this Some more Text
I think I've managed to solve it:
String st = "Some Text \\LThis is \\\\L What I want \\\\l and this\\l Some more Text";
String newstring = st.replaceAll("(\\\\L)(.*)(\\\\l)", "$2");