Tuesday 15 March 2011

regex - Java match Code for Number "0" and "1" -



regex - Java match Code for Number "0" and "1" -

my problem.

a string can contain numbers "0" , / or "1".

it possible check string "match" 1 , 0?

if yes, how have "match" write.

if (eingabe.length() <= 0 || eingabe.matches("[0-1]")) { system.err.println("bitte geben sie mindestens eine ziffer von 0 bis 1 ein."); system.exit(1); }

thank you.

if (eingabe.matches("[01]*")) { // code }

java regex

No comments:

Post a Comment