【发布时间】:2019-01-01 00:24:03
【问题描述】:
我正在尝试在我的应用程序中建立一个深层链接。我需要支持的路径模式看起来像
网址:www.host.com/somestring-/ 示例:好的 URL:www.host.com/Portland-OR/ 错误网址:www.host.com/Portland-、www.host.com/-OR、www.host.com/-、www.host.com/Por-O
所以我有一组至少 1 个字符或更长的字母数字字符集。然后我有一个“-”,然后是 2 个字符。我试过了
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="host.com" android:pathPrefix="/.*-.*/" />
</intent-filter>
我也阅读了以下文档及其相关的源代码。 https://developer.android.com/reference/android/os/PatternMatcher
任何帮助将不胜感激。谢谢!
【问题讨论】:
-
这可能超出了
<data>的模式匹配语言所能支持的范围。 -
可以说“alphanumeric-2characters”吗?
-
我不知道,抱歉。这是一个非常有限的模式匹配器。
标签: android android-intent intentfilter