possible characters base64 url safe function possible characters base64 url safe function php php

possible characters base64 url safe function


Base64 encoded strings may contain the characters a-z A-Z 0-9 + / =.

You're removing the right-padding = and replacing + with - and / with _.

So in your case, the possible characters are a-z A-Z 0-9 - _

More Info


The range of possible characters returned are:

  • A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
  • a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • - (minus) and _ (underscore)

In your regex-style, that would be [a-zA-Z0-9_-].