lundi 24 septembre 2018

How to parse query parameters in Java that works with all delimiters?

So according to this answer, it seems that any character can be used to separate query parameters in a URL.

Hence a regex matcher for & delimiter, such as the following, will fail when ; or | or something else is used for example:

private static final Pattern MATCHER = Pattern.compile("name=([^&#]*)");

So is there a GENERIC way of extracting query parameters from a URL, given that ANY valid delimiter could have been used in that URL ?

Aucun commentaire:

Enregistrer un commentaire