根据[RFC 1738] [1]
[1]:http://www.ietf.org/rfc/rfc1738.txt在HTTP标头,查询参数和路径参数中存在不安全字符,应将其过滤掉。我正在尝试为所有可以允许或列入白名单的字符获取正则表达式
答案 0 :(得分:0)
看看https://docs.oracle.com/javase/9/docs/api/java/util/regex/Pattern.html中的“字符类”
节选:
Character classes
[abc] a, b, or c (simple class)
[^abc] Any character except a, b, or c (negation)
[a-zA-Z] a through z or A through Z, inclusive (range)
[a-d[m-p]] a through d, or m through p: [a-dm-p] (union)
[a-z&&[def]] d, e, or f (intersection)
[a-z&&[^bc]] a through z, except for b and c: [ad-z] (subtraction)
[a-z&&[^m-p]] a through z, and not m through p: [a-lq-z](subtraction)