[Solved] Regex to seperate a work and decimal number
#!/usr/bin/python2 # -*- coding: utf-8 -*- import re text=”{[FACEBOOK23.1K],[UNKNOWN6],[SKYPE12.12M]}”; m = re.findall(‘\[([a-z]+)([^\]]+)\]’, text, re.IGNORECASE); output=”{“; i = 0 for (name,count) in m: if i>0: output += ‘,’ output += “[“+name+”,”+count+”]” i=i+1 output += ‘}’ print output 4 solved Regex to seperate a work and decimal number