I have the following Regular Expression, how can I modify it to also allow null?
[0-9]{5}|[0-9]{10}
I would like it to allow a 5 digit number, a 10 digit number, or null
Thanks
i have a good question, i couldnt find any answers so far, so im asking here...
The problem is this, im using a regular expression to validate certain format in a string, ...
Java itself doesn't. You can use IntRange though, or use a simple collection like a Set (use TreeSet or LinkedHashSet to keep the range ordered) or a List implementation. As for the regular expression, you can create one to extract the lower and upper bounds, but not to generate the numbers. You need to combine both solutions - one to extract ...
I wasn't giving working code, something for the op to go off of, given the light amount of information provided I don't even know if it would be possible to give code that would work completely. I suppose It would have been better if I had: 1) written code that compiles or 2) made a note that this is more pseudo ...