-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
  • 18,500
  • 41
  • 58
  • 88
Frank
  • 29,646
  • 56
  • 159
  • 233

2 Answers2

2

Use the following regex

 str= str.replaceAll("\((.+)\)", "");
cнŝdk
  • 30,215
  • 7
  • 54
  • 72
0

You can use this regex:

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

With substitution $1

[Regex Demo]

shA.t
  • 15,880
  • 5
  • 49
  • 104