Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class UrlUtils {
public static String[] breakUri(final String uri, final String expectedUrl) {
Pattern p = Pattern.compile(expectedUrl.replace("*", "(.*?)"));
Matcher m = p.matcher(uri);
if (m.find()) {
String[] ret = new String[m.groupCount()];
for (int i=0; i<ret.length; i++) {
ret[i] = m.group(i+1);
}
return ret;
}
else {
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment