此处match必须完全匹配才为true
- String boardName = "lvyuan[111]";
- String regex = ".*\\[[0-9]+\\]$";
-
- if (boardName.matches(regex)) {
- System.out.println("OK");
- }
此处match必须完全匹配才为true
- String boardName = "lvyuan[111]";
- String regex = ".*\\[[0-9]+\\]$";
-
- if (boardName.matches(regex)) {
- System.out.println("OK");
- }