Tengo un texto con contenido de cadena y una etiqueta. Quiero dividir el texto en una matriz. Lo intenté de muchas maneras pero obtuve algunos errores @@
Aporte:
"This is a text with a @[name of tag](tagId). This is another @[name of another tag](tagId)"Producción:
array = ["This is a text with a ", "@[name of tag](tagId)", ". This is another " , "@[name of another tag](tagId)"]La etiqueta siempre tiene @[ al principio, ) al final y ]( en el medio,
Lo intenté
const str = "This is a text with a @[name of tag](tagId). This is another @[name of another tag](tagId)" const result = str.split(/[@[)]/); console.log(result);Pero eso tiene muchos problemas como "", "" o falta @[ en el resultado
gracias por toda la ayuda