Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在javascript中,我想确定一个字符串是否仅由十六进制字符组成。即,我想检查字符串是否是范围内的连续字符块a-f, A-F, 0-9。我怎么能在javascript中做到这一点。
a-f, A-F, 0-9
就像是:
/^[a-f0-9]+$/i.test("ABCDEF")
或者
var r = new RegExp("^[a-f0-9]+$", 'i') r.test("ABCDEF");