I have to process text file like that: text 01/01/1970 text 02/01/1970 ... etc. I want the output to be the following data: according to the docs, wrapping the string you're splitting on in () (making it a capture group) will result in these captures being included in the array.