user274069
user274069

Reputation: 217

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 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

Note: dash(-----) range after each sentence is between 10 to 50

Upvotes: 1

Views: 152

Answers (2)

unigg
unigg

Reputation: 464

sttr.split(/-+/g);

Test it with regular expression tester

Upvotes: 0

polygenelubricants
polygenelubricants

Reputation: 383756

You want to split on /-{10,50}/g.

See also

Upvotes: 1

Related Questions