android java正则表达式命名组

前端之家收集整理的这篇文章主要介绍了android java正则表达式命名组前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想用
matcher.group("login");

在eclipse上的android 8中,但似乎没有Matcher.group(String)存在.
你有(内置)解决方案吗?

解决方法

Android Pattern类实现由ICU提供,准确地说是 ICU4C.

The regular expression implementation used in Android is provided by 07002. The notation for the regular expressions is mostly a superset of those used in other Java language implementations. This means that existing applications will normally work as expected,but in rare cases Android may accept a regular expression that is not accepted by other implementations.

而且ICU4C目前不支持命名捕获组.你必须依靠编号的捕获组.

ICU does not support named capture groups. 07003

如果确实需要该功能,则需要编写包装器并自行解析表达式以提供命名捕获组功能.

猜你在找的Android相关文章