Pattern is not splitting as desired, fails to split by +

前端 未结 2 648
猫巷女王i
猫巷女王i 2021-01-23 20:30

I have the following code :

Pattern pattern = Pattern.compile(\"\\\\d+(?:\\\\.\\\\d+)?(\\\\s\\\\d+(?:\\\\.\\\\d+)?)*\\\\s*[-\\\\+\\\\*/\\\\$£]\");

String input          


        
2条回答
  •  不思量自难忘°
    2021-01-23 21:06

    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.

提交回复
热议问题