I have the following code :
Pattern pattern = Pattern.compile(\"\\\\d+(?:\\\\.\\\\d+)?(\\\\s\\\\d+(?:\\\\.\\\\d+)?)*\\\\s*[-\\\\+\\\\*/\\\\$£]\");
String input
Maybe I am missing something, but from what you describe, I don't see why it needs to be so complicated. "[\\d. ]+?[-+/*£$]"
seems to do exactly what you want.
You can use this regex:
((?:\d+(?:\.\d+)?(?:\s+\d+(?:\.\d+)?)*)?\s*[-+*/$£])
In Java it would be:
Pattern pattern = Pattern.compile
( "((?:\\d+(?:\\.\\d+)?(?:\\s+\\d+(?:\\.\\d+)?)*)?\\s*[-+*/$£])" );