newlines in base64 encoded content
ellcs opened this issue · 2 comments
ellcs commented
# generate a test file
cat /dev/urandom| base64 | dd count=2000 > test.file
# have a look at the test file
cat test.file
lrhq3tSye69PjO+XfHftxGsCERmN2MgK6jcU5vD7Cg6jmVaF+7dTo3CTUL92xmIash9j3mACBDca
d0vJNbpGwR9pRi8SsBuDoxUrnbnBICmzQmQqe1lELJy1D41k9GIXIUoFpC3uvwS7cLv/hfD4phr8
TAlvSXbH4VMF0Lk8hxQH71URFu9y7Go2aIEpsSyry4zSunmsc5rgCun0SFzYpdvvgG4AQ5PMRqMr
0XeWUs9EpV2tXXoELB/PQi2okkZkedWXzCuaPKlF7F8pWFGXvCdtEP8PxreOo5pEIb6Jm+0sl/Ix
deP9CoLCcAb3/brD7ulvEsXPH4uPLNlV5y1rLso73cOf97yrH7eNkGbKZZmIk9VJWjYwcTqyTIyt
Cyq7niapSI/HREywvdcwcCW2nPRBNsLqPX9RYzW5f+FZP9wRT09+B6A97OWU1WD560wcxgYeHdB/
cqvM0id8ptT0/HTEt8O+4SU2oU86DK1ad4qmKRlmioVwgBWIVFKGr097+FIj4RMwZO4647Ve6HB/
bpmWFtqELmXxYwD4uCKBogomarUzadlTsIMaGlvccU7sWDKwUSNxKDznkD1jWgJjCwVwgLzN05Qj
/nhB2whw7Wt9amExU9M4/s0UzR4O6J4hayGe8OOS/Us0TQF04bYG1kD1mKEEy46ZtzLKKQs2WTKr
luKl9eBMPI3cGKy3SlPzev1EB/H24urkMNwyu4f8s0mVm94igpGfP5UGK4ATOO6E8GiMz9nNvVY0
e2vbg4MbZ54R44ygFqK4tXyjMauOk2aHg0fYKb2uKSIhAjN924HBdJFg28dBz/u+tb9jH0trPpEQ
gAmngauTP/y4T/l2hIzH3AE3M1DDqTE4d2o9SH1bI1P6/EPpNbD2EV0Z54dk4YWz+VSRPj9eFKTj
YrRngkV+mvi8nftq277xTlVJFsjcZbGa3I4ldLPN6gBC6pURKldQpVOK7b89Bl4ynW91DefEDI98
+ULoBJKyud4fkBLb7jTuO6WRNbJW1TJY7Tsln6XJSd1nhC71+Mty83K7Iv5HxkyvDJjhDyRp56Za
A/FiK2zxyaf6gFSD9Yb92RmppGmqzB0xVyjeF3b0vflZFf36gSWAJ3gDKUOK+WudUZZxQA/Ixi4t
#...
# notice that there are newlines which could seperate the candidates
Expectation
The regex can handle optional newlines between the chars.
ellcs commented
grep -PUzob "(aGVsbG8gd29ybG(Q|R|S|T)|(G|W|m|2)hlbGxvIHdvcmxk|(B|F|J|N|R|V|Z|d|h|l|p|t|x|1|5|9)oZWxsbyB3\\n?b3JsZ(A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P))"
ellcs commented
# new lines can come anytime
$ cat b64
ICAgICAg
ICAgICAgICB
oZWxsbyB3
b3JsZAo=
$ cat b64 | base64 -d
hello world