gpt4 book ai didi

android java正则表达式命名组

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:34:27 27 4
gpt4 key购买 nike

我想用

matcher.group("login");

在 android 8+ on eclipse 中,但似乎不存在 Matcher.group(String) 。您有(内置的)解决方案吗?

最佳答案

安卓Pattern类实现是由ICU提供的,准确的说是ICU4C .

The regular expression implementation used in Android is provided by ICU. 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. http://bugs.icu-project.org/trac/ticket/5312

如果您确实需要该功能,您需要自己编写一个包装器并解析表达式以提供命名捕获组功能。

关于android java正则表达式命名组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27834463/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com