i'm new here and this is my first question. I researched this topic as best as I could and almost found my solution. I have examples of strings that look like this:
String product = "1 x Winter gloves \"Husky\" - wool(60 dollars)"
I am trying to extract only the product name: Winter gloves "Husky" - wool
I know there are two possible solutions, either with .replaceAll method or with Pattern Matcher.
I tried this:
System.out.println(product.replaceAll(".*x ([^;]*)", "$1"));
output is this :
Winter gloves "Husky" - wool(60 dollars)
I just need to finalize the formula so that the string will "stop" at the first "(" symbol it encounters. This way I will get my desired result: Winter gloves "Husky" - wool
Any help is appreciated. Thanky you.