Skip to content

Commit

Permalink
improve class pattern (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangtianyu authored Sep 1, 2024
1 parent 5ca10ff commit a63721e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/zhongan/devpilot/util/NewFileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ private static PsiDirectory createPsiDirectory(Project project, String dirPath)
}

private static String extraClassNameFromGeneratedText(String generatedText) {
String regex = "public class (\\w+) \\{";
String regex = "(?:public\\s+)?(?:abstract\\s+|final\\s+)?(class|interface|enum)\\s+(\\w+)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(generatedText);

String generatedClassName = null;
if (matcher.find()) {
generatedClassName = matcher.group(1);
generatedClassName = matcher.group(2);
}
return generatedClassName;
}
Expand Down

0 comments on commit a63721e

Please sign in to comment.