I have a long string, consisting of multiple sentences, of various length, divided by a "-
".
我有一个长字符串,由多个句子组成,长度不同,除以一个“-”。
I want to iterate over the string and extract everything between the -
's, preferably to an array.
我想遍历字符串并提取- s之间的所有东西,最好是一个数组。
From another thread I found something that gets me pretty close, but not all the way:
从另一个线索,我发现了一些让我很接近的东西,但不是所有的方式:
longString.scan( /-([^-]*)-/)
Needless to say, I am new to Ruby, and especially to RegEx.
不用说,我是Ruby的新手,尤其是RegEx。