wrong regex. ismatch() matches the whole string; that's not what you appear to want. use regex.matcher(), then if regex.matcher.find(). you seem to be looking to validate the input (ie, no garbage chars), not match the actual input, yes?
btw, "\d" is part of "\w". you don't need "\d". also, if your names can contain spaces, "\w" will fail. the space char is not part of "\w" (nor is the "+" char, but i wasn't sure if you were using it as some kind of test)
thanks a lot @DonManfred and @drgottjr .
in fact I'm trying to register my device name (galaxy grand prime+) in the example of Android push notification. and Every time I get an error.