#jree fava lezzonz
1 messages · Page 1 of 1 (latest)
is there a minimum amount of numbers
the center of this is probably a group that repeats some unknown amount of times
but then the issue is how do you know which variant of a number it is
0
might be just an empty string or space
if there are no numbers in the string, i just need to return 0
this is pretty intense
i dont know how to make a "match this group or match this other group
like idk if you can put groups into the []
my first take was like
"-?\\d+(e\\-?\\d+)|(\\.\\d+)?"
-? to test if there is a leading -
\\d+ to get the number
(e\\-?\\d+) to get the number after e
(\\.\\d+)? to get the .num2 if it exists
since if there is plus in the beginning i ingore it anyways
oh right I forgot about |
what are you using to test it
also whats wrong with that one you sent
If I add some extra brackets the test input is working for me -?\\d+((e\\-?\\d+)|(\\.\\d+))?
it doesn't work
i'm not allowed to use .split or .trim, but i can use regex
so, don't split using either one of those
I'd do a isValidNumber function and then just push the parsed numbers to a List
or if you can use commons, you could use NumberUtils#isCreatable
depends on how many things you consider numbers
did u solve it?
it doesnt sound that difficult using regex
it consists of just the number class, +- class (0 to 1 length), and some constants
unless i got it all wrong?
also when showing us regex, one \ is enough
else it looks like u're escaping backslash which u're not
if u're parsing just group it (named groups may provide help when debugging)