I'm stuck trying to write this regular expression that I need. Basically, I have a long string consisting of two different data types:
- [a-f0-9] {32}
- [A-Za-Z0-9 =] {x}
The fact is that x is only a constant in a specific instance: if in one case it is 12, there will be 12 for this particular data set, but the next time I run the regular expression, it may take 15, or 45, for example. I have an unpredictable number of types (1) between each part of type (2). My goal is to "collect" all data of type (2).
For example, I could have a line like this:
[a-f0-9]{192} [a-zA-Z0-9=]{11} [a-f0-9]{96} [a-zA-Z0-9=]{11} [af-0-9]{160} [a-zA-Z0-9=]{11}
(All together without separators) . I need to return a string consisting of 33 characters of the character set [a-zA-Z0-9 =]. The fact that the number of characters in each of the substrings is a constant in the instance (in the case of 11 above, but it could just be 13) is vital, because since it contains a smaller set of characters, otherwise it is impossible to know where one line begins and the other ends.
I have been trying to get this to work for almost a month, and I'm close to tearing my hair out. I am not very good at regular expressions ...
Sample data:
3c21e03a10b9415fb3e1067ea75f8205 c8dc9900a5089d31e01241c7a947ed7e d5f8cd6bb86ebef6d7d104c84ae6e8a7 e23c99af9c9d6d0294d8b51094c39021 4bb4af7e61760735ba17c29e8f542a66 875da91e90863f1ddb7e149297fc59af cf5de951fb65d06d2927aab7b9b54830 e2d935616a54c381c2f38db3731d5a37 SGVsbG8gbXk 6dd11d15c419ac219901f14bdd999f38 0ad94e978ad624d15189f5230e5435a9 2dc19fe95e583e7d593dd52ae7e68a6e 465ffa6074a371a8958dad3ad271181a 23310939b981b4e56f2ecee26f82ec60 fe04bef49be47603d1278cc80673b226 gbmFtZSBpcy 3c21e03a10b9415fb3e1067ea75f8205 c8dc9900a5089d31e01241c7a947ed7e d5f8cd6bb86ebef6d7d104c84ae6e8a7 e23c99af9c9d6d0294d8b51094c39021 BvbGl2ZXIga 4bb4af7e61760735ba17c29e8f542a66 875da91e90863f1ddb7e149297fc59af cf5de951fb65d06d2927aab7b9b54830 e2d935616a54c381c2f38db3731d5a37 G9vcmF5IQ==
I would like to extract "SGVsbG8gbXkgbmFtZSBpcyBvbGl2ZXIgaG9vcmF5IQ ==".
regex encryption
Mala
source share