Remove everything in parentheses java using regex

前端 未结 7 1017
忘掉有多难
忘掉有多难 2020-12-16 20:01

I\'ve used the following regex to try to remove parentheses and everything within them in a string called name.

name.replaceAll(\"\\\\(.*\\\\)\"         


        
相关标签:
7条回答
  • 2020-12-16 20:48

    If you read the Javadoc for String.replaceAll(), you'll notice that it specifies that the resulting string is the return value.

    More generally, Strings are immutable in Java; they never change value.

    0 讨论(0)
提交回复
热议问题