Ok so i have this string
Something 06/15/2009 some other data 33 77
And I want to seperate then like this
Something
06/15/2009
some other data
33
77
Any idea a clean way to do this
Ok so i have this string
Something 06/15/2009 some other data 33 77
And I want to seperate then like this
Something
06/15/2009
some other data
33
77
Any idea a clean way to do this
I would use regex (or split it by spaces?).
Here's a quick regex that split it up for you
([a-zA-Z0-9\/]*\s)
http://rubular.com/r/qWVj3yr3aw
Edit: didn't notice the one piece of data with spaces. You can still use regex you just need to clarify where one "column" of data starts and ends.
Here's an EXACT match for the data if that's what you're looking for (Although there are better ways considering this statement isn't very useful if "some other data" changes..)
(\w+)\s([\w\/]+)\s(some other data)\s\s(\d*)\s(\d*)
You could try:
/(.+?)\s+(\d+\/\d+\/\d+)\s+(.+?)\s+(\d+)\s+(\d+)/
Gives what you want for the example given at least.
Update:
It might be better to make the .+ parts greedy:
/(.+)\s+(\d+\/\d+\/\d+)\s+(.+)\s+(\d+)\s+(\d+)/
This way, 'something' or 'some other data' can include dates and numbers.