我有以下网址需要解析:
a) https://url:port/abc
b) https://url:port/abc/{uid}
c) https://url:port/abc/{uid}/def
为了弄清楚URL的类型(a,b或c),我正在做:
Pattern a = Pattern.compile(".*\\/abc$");
Pattern b = ??
Pattern c = Pattern.compile(".*\\/abc\\/(.*?)\\/def$");
模式a和c运行正常。尽管我不确定我可以使用哪种模式,以便可以匹配类型b的确切url ,而不必依赖匹配的顺序。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句