I have a string name s,
String s = "He can speak English and Sinhala.[1]He<ename> has edited 12 CSE Staff Research Publications.[1][2]"
I want to remove [1] and [1][2] from the string. Note that we can have any number within the square brackets and any no of square brackets(like [number][number][number]...). I tried using this,
String removedNoTag = s.replaceAll("[\\[0-9\\]]","");
Yes it removes all [number].. patterns. But it also removes all numbers within the text(It removes 12 also).
Can anyone please tell me how to do this?
Because it removes any instance of a character that is either a number or a bracket.
replace with :
\\[[0-9]+\\]