I am trying to replace all strings that can contain any number of blank spaces followed by an ending ";", with just a ";" but I am confused because of the multiple blank spaces.
"ExampleString1 ;" -> "ExampleString1;"
"ExampleString2 ;" -> "ExampleString2;"
"ExampleString3 ;" -> "ExampleString3;"
"ExampleString1 ; ExampleString1 ;" -----> ExampleString1;ExampleString1
I have tried like this: example.replaceAll("\\s+",";")
but the problem is that there can be multiple blank spaces and that confuses me