Necesito extraer el siguiente texto (KNAB3512BJT142015) pero ninguna de mis fórmulas funciona ya que mi marcador son corchetes y se meten con la fórmula
aquí el texto global:
de la Collectivité, Paralegatio d RE (D.2.1) B3512 (E) KNAB3512BJT142015 (F.3) 2T070 (J.3) CI (P.6) 7
Gracias por tu ayuda
var str = "de la Collectivité, Paralegatio d RE (D.2.1) B3512 (E) KNAB3512BJT142015 (F.3) 2T070 (J.3) CI (P.6) 7"; var from = "(E) " var start = str.indexOf(from) + from.length; var result = str.slice(start, start + 17); console.log(result)Necesitas escapar de los paréntesis
const str = `de la Collectivité, Paralegatio d RE (D.2.1) B3512 (E) KNAB3512BJT142015 (F.3) 2T070 (J.3) CI (P.6) 7` const re1 = /\(E\) (\w+) \(/; // grab until next space and left bracket console.log(str.match(re1)[1]) const re2 = /\(E\) (\w{17}) \(/; // grab 17 chars after (E) pluse space console.log(str.match(re2)[1]) console.log(str.split("(E)")[1].slice(1,18)); //split on (E) and take the next 17 after skipping the space