regex split problem
I have javascript string variable with
var sttr="We prefer questions that can be answered --------------------- not just discussed ---------------------
Provide details ---------------------------- Write clearly and simply --------------------------answer all the question"
please suggest how to split the string into array of sentences on the basis of dashes(-----) using regex
result should be
array[0]=We prefer quest开发者_如何学Cions that can be answered
array[1]=not just discussed
array[2]=Provide details
array[3]=rite clearly and simply
array[4]=answer all the question
Note: dash(-----) range after each sentence is between 10 to 50
You want to split on /-{10,50}/g
.
See also
- regular-expression.info/Limiting repetition
- Javascript regular expressions methods and usage
sttr.split(/-+/g);
Test it with regular expression tester
精彩评论