Find text javascript

前端 未结 7 1178
醉话见心
醉话见心 2021-01-26 16:32

I Have string random length

Ex:

 sadsadsadsad(323213)dfsssds

 sadsadsadsad(321)dfsssds

How can I find the values in brackets?.

<
7条回答
  •  生来不讨喜
    2021-01-26 16:56

    Try This:

    var str =  'sadsadsadsad(321)dfss888s(120)ds';
    
    str.match(/\(\d+\)/g).map ( value => { console.log( value.replace(/[)(]/g, '') ) } );

提交回复
热议问题