Here is a regular expression (for base64) that matches every 5 characters in a string:
/[a-zA-Z0-9/+]{5}/g
For example, if the input string is:
"19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAw"
The resulting matches would be:
- 19jZ2
- uLj5O
- Xm5+j
- p6vLz
- 9PX29
- /j5+v
- /aAAw
To achieve a regex pattern for all possible consecutive 5-character matches in the string, you would write:
- 19jZ2
- 9jZ2u
- jZ2uL
- Z2uLj
- 2uLj5
- uLj5O
- and so on...
(^This will match literally every possible 5 consecutive characters in the string)