I'm trying to make a regex that would produce the following results :
- for
7.0 + 5 - :asc + (8.256 - :b)^2 + :d/3
: 7.0, 5, :asc, 8.256, :b, 2, :d, 3 - for
-+*-/^^ )ç@
: nothing
It's should first match numbers which can be float, so in my regex I have : [0-9]+(\\.[0-9])?
but it should also mach special cases like :a or :Abc.
To be more precise, it should (if possible) match anything but mathematical operators /*+^- and parentheses.
So here is my final regex : ([0-9]+(\\.[0-9])?)|(:[a-zA-Z]+)
but it's not working because matcher.groupCount()
returns 3 for both of the examples I gave.