You're right about assigning with () instead of []. The part I didn't explain is that the "Test cases" are one at a time and using regular expression seems to be the most straight forward way of doing it. All I am trying to say in the regexp is, to only SPLIT the string if it has two words, excluding one word and if its a filename( a word followed by a .(dot) ) and letters as extensions.