Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使正则表达式只接受带重音的小写和大写。我尝试:
Pattern pattern = Pattern.compile("[a-zA-Z]"); Matcher matcher = pattern.matcher("teggR4=$*h");
但它无法接受数字和其他字符。
这是您的正则表达式: ^[a-zA-Z]+$ 请参阅您以前的问题以获得不同的答案:如何使正则表达式在 java 中只接受带有重音符号的大写和小写字母? 希望能帮助到你。干杯。
^[a-zA-Z]+$