[ create a new paste ] login | about

Link: http://codepad.org/70EHhuI1    [ raw code | output | fork ]

Python, pasted on Oct 13:
1
2
3
4
5
6
7
import re;

s = "ABC12DEF3G56HIJ7"
pattern = re.compile(r'([A-Z]+)([0-9]+)');

for (letters, numbers) in re.findall(pattern, s):
    print numbers, '*', letters


Output:
1
2
3
4
12 * ABC
3 * DEF
56 * G
7 * HIJ


Create a new paste based on this one


Comments: