Reputation: 47
I am trying to create a script that takes in a string with an unknown number of parts that are separated by ';'
.
"blah blah one; blah blah two"
I tried to use the (?: re) example from rubydocs but had no luck with it. Can someone show me the best way to do this?
Upvotes: 0
Views: 879
Reputation: 25599
you can just use the split method
a='blah blah blah;blah foo blah'.split(";")
the parts will be store in index from 0 to 1 (in the above example )
Upvotes: 2