I am trying to split a string in JAVASCRIPT using regEx,
String to split = "Base text \n 1. option one \n 2. Option two \n 3. Option three \n 4. Option four"
Expected output = [Base text , option one , Option two , Option three , Option four]
But with the regEx I tries I am getting the reg ex in the array as below
[Base text ,1., option one ,2., Option two ,3., Option three ,4., Option four]
RegEx tried - String.split( new RegExp(/\s*(\d\.|\d\))/g))
String.split( new RegExp("\\s*(\\d\\.|\\d\\))\\s*"))
\d)
too? Such as 1) Option x ?