This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Do you mean only those four exact sequences are valid? If so, the easiest way to validate the input is with a simple comparison: If those are just examples, how strictly does the input have to conform to them? Does there have to be zero or one digit before the decimal point, and two or three after?
Here is the recipe! 1.trim the string 2.remove the first and last character as they are [ and ] 3.use a string tokenizer with the space as a separator( I think it is the default) 4.For each token string 4.1 trim 4.2 Remove the last character because it is the letter u 4.3 parse double with Double class. 4.4 insert that double in a list or whatever you need