我有 2 个具有此类值的字符串:String name = "Scripy";String username = "adil";当我用正则表达式检查这些字符串时,我得到了false价值:if(name.matches("/[a-zA-Zа-яА-ЯёЁ ]+/")){ System.out.println("Name: true");}else{ System.out.println("Name: false");}if(username.matches("/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/")){ System.out.println("Username: true");}else{ System.out.println("Username: false");}结果:I/System.out: Name: falseI/System.out: Userame: false问题是什么?
添加回答
举报
0/150
提交
取消