1
1
mirror of https://github.com/wader/fq.git synced 2024-12-23 05:13:30 +03:00

snippets: urlencode: only 0-9a-f

This commit is contained in:
Mattias Wadman 2021-08-19 21:21:57 +02:00
parent a5b802b288
commit fda1dda1ae

View File

@ -14,10 +14,11 @@ def flac_dump:
def urldecode:
gsub(
"%(?<c>..)";
"%(?<c>[a-fA-F0-9]{2})";
( .c
| ascii_downcase
| explode
# "0"-"9" or "a"-"f"
| map(.-48 | if .>=49 then .-39 else . end)
| [.[0]*16+.[1]]
| implode