开发者

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

开发者 https://www.devze.com 2023-02-28 10:01 出处:网络
What would be the Java regular expression to match a Java method return type such as the following: ArrayList<CodeObject开发者_运维技巧>

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

精彩评论

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