查找文本 javascript

2022-01-20 00:00:00 text find javascript

我有字符串随机长度

例如:

 sadsadsadsad(323213)dfsssds悲伤悲伤(321)dfsssds

如何找到括号中的值?

取值随机长度

感谢阅读

解决方案

试试这个:

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

I Have string random length

Ex:

 sadsadsadsad(323213)dfsssds

 sadsadsadsad(321)dfsssds

How can I find the values in brackets?.

Value random length

Thank for reading

解决方案

Try This:

var str =  'sadsadsadsad(321)dfss888s(120)ds';

str.match(/(d+)/g).map ( value => { console.log( value.replace(/[)(]/g, '') ) } );

相关文章