Reputation: 1845
I'm having a problem where I need to filter out "longer" path to not be captured by intent filter
.
As printed out in the code below,
PatternMatcher pm = new PatternMatcher("/..*/..*", PatternMatcher.PATTERN_SIMPLE_GLOB);
Boolean b = pm.match("/segment/segment");
Boolean c = pm.match("/segment/segment/segment");
AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create();
alertDialog.setTitle("Alert");
alertDialog.setMessage(b.toString() + ',' + c.toString());
It shows true,true
as the result.
Is there any way to make the result as true,false
?
Changing the regex to /..*/..*/
and url to /segment/segment/
is impossible.
Thank you. I appreciate discussions
Upvotes: 5
Views: 238
Reputation: 2406
^([/][A-Za-z0-9\s!@#$%^&()';{}\[\]=+\-_~`.\\]+){2}
You can use this regular expression to make the result as true, false
if
there is one, three more segments
Upvotes: 1