正则表达式分裂问题

时间:2010-04-16 04:00:37

标签: javascript regex

我有

的javascript字符串变量
var sttr="We prefer questions that can be answered --------------------- not just discussed ---------------------
Provide details ---------------------------- Write clearly and simply --------------------------answer all the question"

请建议如何在短划线的基础上将字符串拆分为句子数组(-----)使用正则表达式

结果应该是

array[0]=We prefer questions 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

注意:每个句子介于10到50之间的短划线(-----)范围

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

sttr.split(/ - + /克);

使用regular expression tester

进行测试