I Have string random length
Ex:
sadsadsadsad(323213)dfsssds
sadsadsadsad(321)dfsssds
How can I find the values in brackets?.
<Try by using the following code it will helps you if you have remove nested Parentheses example "a(bcdefghijkl(mno)p)q"
function removeParentheses(s) {
let openPatterns = [];
for(let i=0; i < s.length; i++){
if(s[i] == '('){
openPatterns.push(i);
}
if(s[i] == ')'){
const lastIndexOpen = openPatterns.pop();
const originalTxt = s.slice(lastIndexOpen ,i+1);
//here you have the raw text
const rawText = s.slice(lastIndexOpen+1,i);
//this code works to remove the parentesis
//s= s.replace(originalTxt, reverseTxt);
//i-=2;
}
}
return rawText;
}