-6

I have some text like this : Javascript (12+ years), Java (10 years) How to use regular expression to extract the following text : Javascript, Java

I've seen that link, have you tried it ? It doesn't work in my case ! The answer below works : replaceAll("\\((.+)\\)","")

ketan
  • 19,129
  • 42
  • 60
  • 98
Frank
  • 30,590
  • 58
  • 161
  • 244

2 Answers2

2

Use the following regex

 str= str.replaceAll("\((.+)\)", "");
cнŝdk
  • 31,391
  • 7
  • 56
  • 78
0

You can use this regex:

(.*?)(\s*\(.*?\))

With substitution $1

[Regex Demo]

shA.t
  • 16,580
  • 5
  • 54
  • 111