开发者

Java regex for a method signature with a Collection<GenericType> return type

What would be the Java regular expression to match a Java method return type such as the following:

ArrayList<CodeObject开发者_运维技巧>


Given the existence of:

 Map<List<String>, Map<List<String>, Collection<Integer>>>

just for starters, I'm going to claim that this is a bad job for a regexp. Regexps are not good at matching nested items. See this post for the deleterious effects on mental health of trying.

For the simple case I think the following would serve.

 \p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*<\p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜