I have the following code :
Pattern pattern = Pattern.compile(\"\\\\d+(?:\\\\.\\\\d+)?(\\\\s\\\\d+(?:\\\\.\\\\d+)?)*\\\\s*[-\\\\+\\\\*/\\\\$£]\"); String input
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*[-+*/$£])" );