[Solved] Regex: How to match instances of text, including spaces and new lines? [closed]

You’re asking to match any number of lines of text, followed by only 1 additional newline at the end, simply: ^(.+\n)+\n(?!\n) will do what you’d like. Example here: https://regex101.com/r/Hy3buP/1 Explanation: ^ – Assert position at start of string (.+\n)+ – Match any positive number of lines of text ending in newline \n – Match the … Read more

[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