I'm adding an intent filter to my android application and I want it to catch requests that go http://www.somedomain.com/[numericValue] . I only want to catch it if the path is numeric, but if it has text, I don't care about it.
I tried the pathP开发者_如何学Goattern of [0123456789]*, but that didn't work. Is this possible to do?
The pathPattern
is not a full regex. Rather, it uses a "simple glob", where *
means zero or more of the immediately preceding character -- in your case, zero or more ]
characters.
Off the top of my head, I do not see how you can convert your desired pattern into something that can readily match a "simple glob".
I have tested KTibow sample but that does not work.
But a way to hack it is that it is possible to add multiple data elements and solve it like this, so you get all cases starting with a numeric value. It is not perfect but seems like the only option based on the documentation and that it does not seems possible to do something like /0*1* as it for some reason only matches /1 and /01 when tested.
<data
android:host="example.com"
android:pathPattern="/0.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/1.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/2.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/3.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/4.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/5.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/6.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/7.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/8.*"
android:scheme="https" />
<data
android:host="example.com"
android:pathPattern="/9.*"
android:scheme="https" />
精彩评论