I want to remove any substring(s) in a string that begins with ‘galery’ and ends with ‘jssdk));’
For instance, consider the following string:
Galery something something…. jssdk));
I need an algorithm that removes ‘something something….’ and returns ‘Galery jssdk));’
This is what I’ve done, but it does not work.
newsValues[1].replaceAll("Galery.*?jssdK));", "");
Could probably be improved, I’ve done it fast:
UPDATE Thx for accepting the answer, but here is a smaller reviewed version:
The idea is pretty simple actually, split the String into 3 groups, and replace those 3 groups with the first and third, droping the second one.