Remove text between square brackets at the end of string

前端 未结 3 1451
傲寒
傲寒 2021-01-24 03:39

I need a regex to remove last expression between brackets (also with brackets)

source: input[something][something2] target: input[something]

I\'ve tried this, bu

3条回答
  •  灰色年华
    2021-01-24 04:28

    try this code

    var str = "Hello, this is Mike (example)";
    
    alert(str.replace(/\s*\(.*?\)\s*/g, ''));

提交回复
热议问题