-3

I want to split over a string (exemple : ABC-{9090}) with a first and last index using java

I want to get just the value between {} --> output : 9090

1 Answers1

0

You can use below replaceAll for this purpose:

public class StringParsing {
    public static void main(String[] args){
        String s = "ABC-{9090}";
        System.out.println(s.replaceAll("[^\\{]+\\{(.*?)\\}.*", "$1"));

    }
}
Utsav
  • 5,572
  • 2
  • 29
  • 43