Suppose I have a long string:
AX 90 10 20 AX 30 14 50 ER 40 50 68 ...
What I need is
['AX 90 10 20', 'AX 30 14 50', 'ER 40 50 68',...]
I don't want to use a regex as I'll get different pattern of repetition such as the below where regex for above won't work for the below
WE 12 (09/09) ER 14 (12/56) TO 90 (45/67) ...
I started with creating the structural representation(converting [A-Z] to 'A' and [0-9] to '9') for the first example
AX 90 10 20 AX 30 14 50 ER 40 50 68 ...
to
AA 99 99 99 AA 99 99 99 AA 99 99 99 ...
My question is, how do I go by recognizing pattern in each string on the fly and then get the matches?
NOTE: The pattern is unknown, but it is known that some set of charcters repeat after sometime
I don't want to use regex written manually. If system generates the regex, then it would be fine.